From 879a657f8cb846cc43c34f0e933e56ccebf85a57 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Mar 2023 14:20:58 +0200 Subject: [PATCH 01/16] Init CONTRIBUTING.md Explain how to get changes into the existing branches of this repo and what the branches are for --- CONTRIBUTING.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..5fe680a4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Quick branch overview +We work with several branches in this repo. This document aims to explain how +to contribute changes to the existing branches. + +### `main` branch +- Changes to `modules` and `profiles` should go [the main branch](https://git.pub.solar/pub-solar/os/src/branch/main) +- Changes can get accepted via: Pull Request +- Branch protected from direct `git push` + +### `infra` branch +- Changes to the [pub.solar](https://pub.solar) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/infra) +- Changes can get accepted via: Pull Request +- Branch protected from direct `git push` + +### `momo/main` branch +- Changes to the [Momo](https://momo.koeln) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/momo/main) +- Changes can get accepted via: Pull Request +- Branch protected from direct `git push` + +### `$USER` branches +- User's custom hosts and changes can be worked on in these branches +- Direct `git push` possible +- Examples: + - [hensoko](https://git.pub.solar/pub-solar/os/src/branch/hensoko) + - [b12f](https://git.pub.solar/pub-solar/os/src/branch/b12f) + - [axeman](https://git.pub.solar/pub-solar/os/src/branch/axeman) + - [teutat3s](https://git.pub.solar/pub-solar/os/src/branch/teutat3s) From 864f38920f8ea23717a4d5615ef01096f5284341 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 28 Mar 2023 14:31:48 +0200 Subject: [PATCH 02/16] docs: mention ci deployment for momo/main branch --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5fe680a4..8283019b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,6 +15,7 @@ to contribute changes to the existing branches. ### `momo/main` branch - Changes to the [Momo](https://momo.koeln) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/momo/main) - Changes can get accepted via: Pull Request +- Deployment of changes is [automatic via CI pipeline](https://git.pub.solar/pub-solar/os/src/commit/43bd7421509f7cc9ba06d7c740f3f536a4a2af76/.drone.yml#L20-L38) - Branch protected from direct `git push` ### `$USER` branches From c30c1700f41bb585fa3c0b7983cae74191f2f1d7 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 13:14:08 +0200 Subject: [PATCH 03/16] bash: replace $USER with ~ in PROMPT_COMMAND --- modules/terminal-life/bash/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index 9528aee9..c8d4eace 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -19,7 +19,7 @@ in { # Run when initializing an interactive shell initExtra = '' # Show current directory at the top in Alacritty - PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD")\e\\"' + PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD" | sed "s/${psCfg.user.name}/~/")\e\\"' # If a command is not found, show me where it is source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh From ea69c1d12c7404db08ce63b44626afe18820d496 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 02:50:01 +0200 Subject: [PATCH 04/16] neovim: use nixd as nix language server --- modules/terminal-life/nvim/default.nix | 4 ++-- modules/terminal-life/nvim/lsp.vim | 2 +- overlays/overrides.nix | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/terminal-life/nvim/default.nix b/modules/terminal-life/nvim/default.nix index 1afb5088..a2a2171a 100644 --- a/modules/terminal-life/nvim/default.nix +++ b/modules/terminal-life/nvim/default.nix @@ -25,6 +25,7 @@ in { ansible-language-server ccls gopls + nixd nodejs nodePackages.bash-language-server nodePackages.dockerfile-language-server-nodejs @@ -37,9 +38,8 @@ in { nodePackages.yaml-language-server python3Packages.python-lsp-server python3Full - solargraph - rnix-lsp rust-analyzer + solargraph terraform-ls universal-ctags ]; diff --git a/modules/terminal-life/nvim/lsp.vim b/modules/terminal-life/nvim/lsp.vim index 399e52e4..fb28b954 100644 --- a/modules/terminal-life/nvim/lsp.vim +++ b/modules/terminal-life/nvim/lsp.vim @@ -122,9 +122,9 @@ lua < Date: Sun, 2 Jul 2023 14:49:47 +0200 Subject: [PATCH 05/16] devshell: stash only unstaged changes in pre-commit hook --- shell/hooks/pre-commit.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 45efec25..558167eb 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -8,8 +8,18 @@ else fi # Stash only unstaged changes, keeping staged changes +# We have to stash two times, because: +# --keep-index also stashes the staged changes. +# The staged changes end up in both the stage AND the stash. +# https://overflow.hostux.net/questions/7650797/how-to-stash-only-unstaged-changes-in-git#60875082 old_stash=$(git rev-parse --quiet --verify refs/stash) -git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook' +git stash push --quiet --staged --message "Staged changes before pre-commit hook" +git stash push --quiet --message "Unstaged changes before pre-commit hook" +if git stash show "stash@{1}" 2>/dev/null; then + git stash pop --quiet --index "stash@{1}" +else + git stash pop --quiet --index "stash@{0}" +fi new_stash=$(git rev-parse --quiet --verify refs/stash) diff="git diff-index --name-only --cached $against --diff-filter d" From 3d2aed46ab63ea090341995f505e17e76b75e3ca Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 15:16:02 +0200 Subject: [PATCH 06/16] neovim: trim final newline when copying to clipboard --- modules/terminal-life/nvim/clipboard.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/terminal-life/nvim/clipboard.vim b/modules/terminal-life/nvim/clipboard.vim index 7467dcc0..ee9cd4c3 100644 --- a/modules/terminal-life/nvim/clipboard.vim +++ b/modules/terminal-life/nvim/clipboard.vim @@ -5,8 +5,8 @@ let g:clipboard = { \ 'name': 'wayland-strip-carriage', \ 'copy': { - \ '+': 'wl-copy --foreground --type text/plain', - \ '*': 'wl-copy --foreground --type text/plain --primary', + \ '+': 'wl-copy --foreground --type text/plain --trim-newline', + \ '*': 'wl-copy --foreground --type text/plain --primary --trim-newline', \ }, \ 'paste': { \ '+': {-> systemlist('wl-paste --no-newline | tr -d "\r"')}, From 442ba900689be21ae3bdf4a510299b98cbff3935 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:15:15 +0200 Subject: [PATCH 07/16] chore: delete unused files --- modules/compat/default.nix | 12 ---- profiles/base-user/.gitignore | 111 ---------------------------------- 2 files changed, 123 deletions(-) delete mode 100644 modules/compat/default.nix delete mode 100644 profiles/base-user/.gitignore diff --git a/modules/compat/default.nix b/modules/compat/default.nix deleted file mode 100644 index 5c2dab36..00000000 --- a/modules/compat/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -with lib; { - # Both things below are for - # https://github.com/NixOS/nixpkgs/issues/124215 - documentation.info.enable = lib.mkForce false; - nix.settings.extra-sandbox-paths = ["/bin/sh=${pkgs.bash}/bin/sh"]; -} diff --git a/profiles/base-user/.gitignore b/profiles/base-user/.gitignore deleted file mode 100644 index cd8e2eed..00000000 --- a/profiles/base-user/.gitignore +++ /dev/null @@ -1,111 +0,0 @@ -* - -!*.nix -!/.gitignore - -!/.zshrc -!/.Xdefaults -!/.Xresources -!/.xinitrc -!/.config - -!/assets -!/assets/wallpaper.jpg - -!/.config/dircolors - -!/.config/xmodmap - -!/.config/environment.d -!/.config/environment.d/profile.conf -!/.config/environment.d/drone.conf -!/.config/environment.d/restic.conf - -!/.config/user-dirs.dirs -!/.config/user-dirs.locale - -!/.config/gtk-2.0 -!/.config/gtk-2.0/gtkrc - -!/.config/gtk-3.0 -!/.config/gtk-3.0/settings.ini - -!/.config/xsettingsd -!/.config/xsettingsd/xsettingsd.conf - -!/.config/mako -!/.config/mako/config - -!/.config/alacritty -!/.config/alacritty/alacritty.yml - -!/.config/git -!/.config/git/config - -!/.config/vifm -!/.config/vifm/vifmrc -!/.config/vifm/scripts -!/.config/vifm/colors -!/.config/vifm/colors/base16.vifm - -!/.config/nvim -!/.config/nvim/init.vim -!/.config/nvim/clipboard.vim -!/.config/nvim/lsp.vim -!/.config/nvim/quickfixopenall.vim -!/.config/nvim/ui.vim - -!/.config/mimeapps.list - -!/.config/libinput-gestures.conf - -!/.config/sway -!/.config/sway/config -!/.config/sway/config.d -!/.config/sway/config.d/applications.conf -!/.config/sway/config.d/autostart.conf -!/.config/sway/config.d/colorscheme.conf -!/.config/sway/config.d/custom-keybindings.conf -!/.config/sway/config.d/gaps.conf -!/.config/sway/config.d/input-defaults.conf -!/.config/sway/config.d/systemd.conf -!/.config/sway/config.d/theme.conf -!/.config/sway/config.d/biolimo -!/.config/sway/config.d/biolimo/screens.conf -!/.config/sway/config.d/biolimo/inputs.conf -!/.config/sway/config.d/chocolatebar -!/.config/sway/config.d/chocolatebar/screens.conf - -!/.config/waybar -!/.config/waybar/colorscheme.css -!/.config/waybar/config -!/.config/waybar/style.css - -!/.config/mutt -!/.config/mutt/muttrc -!/.config/mutt/base16.muttrc -!/.config/mutt/mailcap - -!/.config/offlineimap -!/.config/offlineimap/functions.py - -!/.local -!/.local/bin -!/.local/bin/install-base -!/.local/bin/swaylock-bg -!/.local/bin/sway-launcher -!/.local/bin/sway-service -!/.local/bin/toggle-kbd-layout -!/.local/bin/wcwd -!/.local/bin/vifmrun -!/.local/bin/vifmimg -!/.local/bin/s -!/.local/bin/windows -!/.local/bin/import-gtk-settings -!/.local/bin/mailto-mutt -!/.local/bin/setup-host-conf -!/.local/bin/steam-xdg - -!/.local/share -!/.local/share/applications -!/.local/share/applications/userapp-Firefox.desktop From ead398b8350374189bba8bd087f5bcdc783e9d44 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:16:11 +0200 Subject: [PATCH 08/16] bash: use latest ble.sh version Use fzf for completion again Fix starship with newest ble.sh version, eval a second time after ble.sh --- modules/terminal-life/bash/default.nix | 8 +++++++- modules/terminal-life/fzf/default.nix | 5 +---- overlays/blesh.nix | 27 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index c8d4eace..3d0c7311 100644 --- a/modules/terminal-life/bash/default.nix +++ b/modules/terminal-life/bash/default.nix @@ -34,7 +34,7 @@ in { # Syntax highlighting, auto suggestions, vim modes, etc. # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs - source "$(blesh-share)" --attach=none + source "$(blesh-share)"/ble.sh --attach=none # ctrl + space to accept autocomplete suggestion ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' # Meta (Alt) + Backspace to delete a word @@ -59,6 +59,7 @@ in { } blehook/eval-after-load complete my/complete-load-hook + bleopt exec_elapsed_mark= bleopt exec_errexit_mark= bleopt filename_ls_colors="$LS_COLORS" @@ -84,6 +85,11 @@ in { fi # end of .bashrc + # Somehow we need to ensure starship starts later than ble.sh + # (possible packaging issue?) + # https://github.com/akinomyoga/ble.sh/issues/333 + eval "$(${pkgs.starship}/bin/starship init bash)" + [[ ''${BLE_VERSION-} ]] && ble-attach ''; diff --git a/modules/terminal-life/fzf/default.nix b/modules/terminal-life/fzf/default.nix index 88e60592..372e768d 100644 --- a/modules/terminal-life/fzf/default.nix +++ b/modules/terminal-life/fzf/default.nix @@ -10,8 +10,5 @@ "--color=fg:#d3d1d4,header:#7accd7,info:#e5c463,pointer:#ef9062" "--color=marker:#ef9062,fg+:#303030,prompt:#e5c463,hl+:#7accd7" ]; - # Use ble.sh for completions, see - # modules/terminal-life/bash/default.nix -> bleopt complete_menu_style=desc - # and https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion - enableBashIntegration = false; + enableBashIntegration = true; } diff --git a/overlays/blesh.nix b/overlays/blesh.nix index f3c93d73..f29c29ec 100644 --- a/overlays/blesh.nix +++ b/overlays/blesh.nix @@ -1,5 +1,32 @@ final: prev: { blesh = prev.blesh.overrideAttrs (oldAttrs: rec { inherit (prev.sources.blesh-nvfetcher) version src; + + dontBuild = false; + buildInputs = [prev.git]; + patchPhase = '' + substituteInPlace GNUmakefile \ + --replace "git submodule update --init --recursive" "" + ''; + nativeCheckInputs = oldAttrs.nativeCheckInputs ++ [prev.busybox]; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/share/blesh/lib" + + cat <"$out/share/blesh/lib/_package.sh" + _ble_base_package_type=nix + + function ble/base/package:nix/update { + echo "Ble.sh is installed by Nix. You can update it there." >&2 + return 1 + } + EOF + + make install INSDIR=$out/share/blesh + + runHook postInstall + ''; }); } From 62933459b96b9a6220f2dcc513f7a963664b6ad2 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:17:34 +0200 Subject: [PATCH 09/16] sway: add explanatory comment to launcher script --- pkgs/sway-launcher.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/sway-launcher.nix b/pkgs/sway-launcher.nix index abc7f443..8eddd857 100644 --- a/pkgs/sway-launcher.nix +++ b/pkgs/sway-launcher.nix @@ -1,6 +1,7 @@ self: with self; '' #!/usr/bin/env bash + # terminal application launcher for sway, using fzf # original command: # Based on: https://github.com/swaywm/sway/issues/1367 # bindsym $altkey+space exec termite --name=launcher -e \ From c73a49d4d2197c47d930946a5541b0751fcbeb16 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:18:05 +0200 Subject: [PATCH 10/16] nvfetcher: clean up unsused waybar entry --- pkgs/sources.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/sources.toml b/pkgs/sources.toml index ac9d5e1a..929cecbc 100644 --- a/pkgs/sources.toml +++ b/pkgs/sources.toml @@ -31,10 +31,6 @@ fetch.github = "zeekay/vim-beautify" src.git = "https://github.com/romainl/Apprentice" fetch.github = "romainl/Apprentice" -[waybar-nvfetcher] -src.git = "https://github.com/Alexays/Waybar" -fetch.github = "Alexays/Waybar" - [blesh-nvfetcher] src.git = "https://github.com/akinomyoga/ble.sh" fetch.github = "akinomyoga/ble.sh" From ef0d7ca68d058709a395cae0cee093789e4c3aca Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:18:40 +0200 Subject: [PATCH 11/16] base-user: add to video group, less should use our keybindings --- profiles/base-user/default.nix | 5 +++-- profiles/base-user/home.nix | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/profiles/base-user/default.nix b/profiles/base-user/default.nix index a2c82d97..bd8815b0 100644 --- a/profiles/base-user/default.nix +++ b/profiles/base-user/default.nix @@ -21,11 +21,12 @@ in { isNormalUser = true; description = psCfg.user.description; extraGroups = [ - "wheel" "input" - "networkmanager" "lp" + "networkmanager" "scanner" + "video" + "wheel" ]; initialHashedPassword = if psCfg.user.password != null diff --git a/profiles/base-user/home.nix b/profiles/base-user/home.nix index 1da6ace5..52ee6fd5 100644 --- a/profiles/base-user/home.nix +++ b/profiles/base-user/home.nix @@ -27,6 +27,16 @@ in { programs.dircolors.enable = true; + programs.less = { + enable = true; + keys = '' + k forw-line + i back-line + K forw-scroll + I back-scroll + ''; + }; + home.file."xinitrc".source = ./.xinitrc; xdg.enable = true; From 002e6970edeff0a8d5afba4ed9629a13749f6fa5 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:28:52 +0200 Subject: [PATCH 12/16] flake: update lock file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated input 'darwin': 'github:LnL7/nix-darwin/7c16d31383a90e0e72ace0c35d2d66a18f90fb4f' (2023-06-09) → 'github:LnL7/nix-darwin/b06bab83bdf285ea0ae3c8e145a081eb95959047' (2023-07-02) • Updated input 'deploy': 'github:serokell/deploy-rs/65211db63ba1199f09b4c9f27e5eba5ec50d76ac' (2023-06-05) → 'github:serokell/deploy-rs/724463b5a94daa810abfc64a4f87faef4e00f984' (2023-06-14) • Updated input 'home': 'github:nix-community/home-manager/e753d659c64c7d158433d87ef7d6151ca1d1817a' (2023-06-12) → 'github:nix-community/home-manager/07c347bb50994691d7b0095f45ebd8838cf6bc38' (2023-06-27) • Updated input 'latest': 'github:nixos/nixpkgs/75a5ebf473cd60148ba9aec0d219f72e5cf52519' (2023-06-11) → 'github:nixos/nixpkgs/645ff62e09d294a30de823cb568e9c6d68e92606' (2023-07-01) • Updated input 'nixos': 'github:nixos/nixpkgs/d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2' (2023-06-10) → 'github:nixos/nixpkgs/b72aa95f7f096382bff3aea5f8fde645bca07422' (2023-06-30) • Updated input 'nixos-hardware': 'github:nixos/nixos-hardware/2a807ad6e8dc458db08588b78cc3c0f0ec4ff321' (2023-06-11) → 'github:nixos/nixos-hardware/429f232fe1dc398c5afea19a51aad6931ee0fb89' (2023-06-15) • Updated input 'nvfetcher': 'github:berberman/nvfetcher/c5ae2cb436a04f4590306589e71638d023a33bd4' (2023-05-27) → 'github:berberman/nvfetcher/44196458acc2c28c32e456c50277d6148e71e708' (2023-06-22) • Updated input 'nvfetcher/flake-utils': 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11) → 'github:numtide/flake-utils/abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c' (2023-06-19) --- flake.lock | 69 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index f1d08d5c..b50347fc 100644 --- a/flake.lock +++ b/flake.lock @@ -30,11 +30,11 @@ ] }, "locked": { - "lastModified": 1686307493, - "narHash": "sha256-R4VEFnDn7nRmNxAu1LwNbjns5DPM8IBsvnrWmZ8ymPs=", + "lastModified": 1688307440, + "narHash": "sha256-7PTjbN+/+b799YN7Tk2SS5Vh8A0L3gBo8hmB7Y0VXug=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "7c16d31383a90e0e72ace0c35d2d66a18f90fb4f", + "rev": "b06bab83bdf285ea0ae3c8e145a081eb95959047", "type": "github" }, "original": { @@ -54,11 +54,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1685948350, - "narHash": "sha256-1FldJ059so0X/rScdbIiOlQbjjSNCCTdj2cUr5pHU4A=", + "lastModified": 1686747123, + "narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=", "owner": "serokell", "repo": "deploy-rs", - "rev": "65211db63ba1199f09b4c9f27e5eba5ec50d76ac", + "rev": "724463b5a94daa810abfc64a4f87faef4e00f984", "type": "github" }, "original": { @@ -202,11 +202,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1687171271, + "narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c", "type": "github" }, "original": { @@ -222,11 +222,11 @@ ] }, "locked": { - "lastModified": 1686582345, - "narHash": "sha256-z4wLfa++k1d7Y/tQpQYub1D0K0OO9Wju0FZ8U53KUE0=", + "lastModified": 1687871164, + "narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=", "owner": "nix-community", "repo": "home-manager", - "rev": "e753d659c64c7d158433d87ef7d6151ca1d1817a", + "rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38", "type": "github" }, "original": { @@ -236,13 +236,34 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682203081, + "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "latest": { "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "lastModified": 1688231357, + "narHash": "sha256-ZOn16X5jZ6X5ror58gOJAxPfFLAQhZJ6nOUeS4tfFwo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "rev": "645ff62e09d294a30de823cb568e9c6d68e92606", "type": "github" }, "original": { @@ -254,11 +275,11 @@ }, "nixos": { "locked": { - "lastModified": 1686431482, - "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", + "lastModified": 1688109178, + "narHash": "sha256-BSdeYp331G4b1yc7GIRgAnfUyaktW2nl7k0C577Tttk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", + "rev": "b72aa95f7f096382bff3aea5f8fde645bca07422", "type": "github" }, "original": { @@ -270,11 +291,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1686452266, - "narHash": "sha256-zLKiX0iu6jZFeZDpR1gE6fNyMr8eiM8GLnj9SoUCjFs=", + "lastModified": 1686838567, + "narHash": "sha256-aqKCUD126dRlVSKV6vWuDCitfjFrZlkwNuvj5LtjRRU=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "2a807ad6e8dc458db08588b78cc3c0f0ec4ff321", + "rev": "429f232fe1dc398c5afea19a51aad6931ee0fb89", "type": "github" }, "original": { @@ -310,11 +331,11 @@ ] }, "locked": { - "lastModified": 1685158767, - "narHash": "sha256-vgyu3jsnGDDAEYg4y/oFk2IaTCXUlce0ZaLtQprhmFk=", + "lastModified": 1687440270, + "narHash": "sha256-aOAXvfVn+MBSkU+xlQEiyoGpRaF6NvQdpWIhw5OH/Dc=", "owner": "berberman", "repo": "nvfetcher", - "rev": "c5ae2cb436a04f4590306589e71638d023a33bd4", + "rev": "44196458acc2c28c32e456c50277d6148e71e708", "type": "github" }, "original": { From 6bc4cd72e94622ff51464d44eb604c27784ca40e Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:29:27 +0200 Subject: [PATCH 13/16] nvfetcher: bump sources From be42efff5074d3d67f2f48f4eb6bda82f33167bc Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 16:37:07 +0200 Subject: [PATCH 14/16] nvfetcher: update sources --- pkgs/_sources/generated.nix | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix index dfe616d8..4a9c9654 100644 --- a/pkgs/_sources/generated.nix +++ b/pkgs/_sources/generated.nix @@ -3,17 +3,17 @@ { blesh-nvfetcher = { pname = "blesh-nvfetcher"; - version = "f16c0d807c8e1fe26fa5d990b561829382cbdc72"; + version = "1afc616b890e487926897e5b3e3a33e0ad833cb3"; src = fetchFromGitHub { owner = "akinomyoga"; repo = "ble.sh"; - rev = "f16c0d807c8e1fe26fa5d990b561829382cbdc72"; + rev = "1afc616b890e487926897e5b3e3a33e0ad833cb3"; fetchSubmodules = true; deepClone = false; leaveDotGit = true; - sha256 = "sha256-+tcM1z9uD7WXA7CfHmTbcPRcZfmXZ+Y7y6Bj4QA3f+4="; + sha256 = "sha256-gDxx7nDleS2HWIJWc208gcTzuRUEu/JCyepTuOJDAGo="; }; - date = "2023-06-12"; + date = "2023-06-29"; }; instant-nvim-nvfetcher = { pname = "instant-nvim-nvfetcher"; @@ -111,16 +111,4 @@ }; date = "2022-07-03"; }; - waybar-nvfetcher = { - pname = "waybar-nvfetcher"; - version = "41164905351436db3a124207261f9dd759c6fa1b"; - src = fetchFromGitHub { - owner = "Alexays"; - repo = "Waybar"; - rev = "41164905351436db3a124207261f9dd759c6fa1b"; - fetchSubmodules = false; - sha256 = "sha256-aogiOj4pe2AJYxQFh8Dw6xQ2Tb6v4W9zwbGX4t2mStI="; - }; - date = "2023-06-27"; - }; } From b2d0c80f79df6483edde0419063f8b7c39189e9d Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sun, 2 Jul 2023 17:56:17 +0200 Subject: [PATCH 15/16] flake: fix broken deploy-rs usage Still doesn't use deploy-rs from nixpkgs because of usage in digga: https://github.com/divnix/digga/blob/main/src/generators.nix#L77 --- flake.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 5394598d..d6cf85a8 100644 --- a/flake.nix +++ b/flake.nix @@ -65,11 +65,10 @@ nixos = { imports = [(digga.lib.importOverlays ./overlays)]; overlays = [ - deploy.overlay (self: super: { deploy-rs = { inherit (inputs.nixos.legacyPackages.x86_64-linux) deploy-rs; - lib = super.deploy-rs.lib; + lib = inputs.deploy.lib.x86_64-linux; }; }) ]; @@ -171,7 +170,7 @@ # profilesOrder = ["system" "direnv"]; # profiles.direnv = { # user = "bartender"; - # path = self.channels.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender; + # path = self.pkgs.x86_64-linux.nixos.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurationsPortable.x86_64-linux.bartender; # }; #}; }; From 3c3abec2380b1e9f8a96242e29027b6c4cf49450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Thu, 13 Jul 2023 16:59:22 +0200 Subject: [PATCH 16/16] fix: move pre-commit treefmt hook into CI The logic inside the hook was rather broken, causing confusing merges, stashes, and aborts. Unfortunately `treefmt` does not provide a pure lint option that checks without writing the changes. So instead, we do this in CI. --- .drone.yml | 4 +++- .editorconfig | 3 +++ CONTRIBUTING.md | 13 +++++++---- shell/hooks/pre-commit.sh | 49 ++++----------------------------------- 4 files changed, 20 insertions(+), 49 deletions(-) diff --git a/.drone.yml b/.drone.yml index 35f2e30d..f83a5264 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,6 +15,8 @@ steps: commands: - 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS' - nix $$NIX_FLAGS develop --command nix flake show + - nix $$NIX_FLAGS develop --command treefmt --fail-on-change + - nix $$NIX_FLAGS develop --command editorconfig-checker - nix $$NIX_FLAGS build ".#nixosConfigurations.PubSolarOS.config.system.build.toplevel" --- @@ -147,6 +149,6 @@ volumes: --- kind: signature -hmac: 6aee0ffe22111bb629c0a79940bfbc3fa75f68c5ed5c4bba68abf6797b87a7ab +hmac: a116f78a0b22188052893bdb46aa40f8de66438826c10ced362ea183d7644d67 ... diff --git a/.editorconfig b/.editorconfig index 96e5188b..91e0b45f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,6 +15,9 @@ end_of_line = unset insert_final_newline = unset trim_trailing_whitespace = unset indent_size = unset +charset = unset +indent_style = unset +indent_size = unset [{.*,secrets}/**] end_of_line = unset diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8283019b..07957e7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,28 +1,33 @@ # Quick branch overview + We work with several branches in this repo. This document aims to explain how to contribute changes to the existing branches. ### `main` branch + - Changes to `modules` and `profiles` should go [the main branch](https://git.pub.solar/pub-solar/os/src/branch/main) - Changes can get accepted via: Pull Request - Branch protected from direct `git push` ### `infra` branch + - Changes to the [pub.solar](https://pub.solar) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/infra) - Changes can get accepted via: Pull Request - Branch protected from direct `git push` ### `momo/main` branch + - Changes to the [Momo](https://momo.koeln) infrastructure should be merged [into this branch](https://git.pub.solar/pub-solar/os/src/branch/momo/main) - Changes can get accepted via: Pull Request - Deployment of changes is [automatic via CI pipeline](https://git.pub.solar/pub-solar/os/src/commit/43bd7421509f7cc9ba06d7c740f3f536a4a2af76/.drone.yml#L20-L38) - Branch protected from direct `git push` ### `$USER` branches + - User's custom hosts and changes can be worked on in these branches - Direct `git push` possible - Examples: - - [hensoko](https://git.pub.solar/pub-solar/os/src/branch/hensoko) - - [b12f](https://git.pub.solar/pub-solar/os/src/branch/b12f) - - [axeman](https://git.pub.solar/pub-solar/os/src/branch/axeman) - - [teutat3s](https://git.pub.solar/pub-solar/os/src/branch/teutat3s) + - [hensoko](https://git.pub.solar/pub-solar/os/src/branch/hensoko) + - [b12f](https://git.pub.solar/pub-solar/os/src/branch/b12f) + - [axeman](https://git.pub.solar/pub-solar/os/src/branch/axeman) + - [teutat3s](https://git.pub.solar/pub-solar/os/src/branch/teutat3s) diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 558167eb..27fff872 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -1,48 +1,9 @@ #!/usr/bin/env bash -if git rev-parse --verify HEAD >/dev/null 2>&1; then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=$(${git}/bin/git hash-object -t tree /dev/null) -fi - -# Stash only unstaged changes, keeping staged changes -# We have to stash two times, because: -# --keep-index also stashes the staged changes. -# The staged changes end up in both the stage AND the stash. -# https://overflow.hostux.net/questions/7650797/how-to-stash-only-unstaged-changes-in-git#60875082 -old_stash=$(git rev-parse --quiet --verify refs/stash) -git stash push --quiet --staged --message "Staged changes before pre-commit hook" -git stash push --quiet --message "Unstaged changes before pre-commit hook" -if git stash show "stash@{1}" 2>/dev/null; then - git stash pop --quiet --index "stash@{1}" -else - git stash pop --quiet --index "stash@{0}" -fi -new_stash=$(git rev-parse --quiet --verify refs/stash) - -diff="git diff-index --name-only --cached $against --diff-filter d" - -mapfile -t all_files < <($diff) - -# Format staged files -if ((${#all_files[@]} != 0)); then - treefmt "${all_files[@]}" && - git add "${all_files[@]}" -fi - -# If unstaged changes were stashed re-apply to working tree -if [ "$old_stash" != "$new_stash" ]; then - git stash pop --quiet -fi - # Check editorconfig -if ((${#all_files[@]} != 0)); then - if ! editorconfig-checker -- "${all_files[@]}"; then - printf "%b\n" \ - "\nCode is not aligned with .editorconfig" \ - "Review the output and commit your fixes" >&2 - exit 1 - fi +if ! editorconfig-checker; then + printf "%b\n" \ + "\nCode is not aligned with .editorconfig" \ + "Review the output and commit your fixes" >&2 + exit 1 fi