diff --git a/.drone.yml b/.drone.yml index 7f8423ac..e0dad8fa 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.flora-6.config.system.build.toplevel" --- @@ -147,6 +149,6 @@ volumes: --- kind: signature -hmac: 5c2b65a2c015f5f11e6d61349693246e3e3c2e88d6aa97d04cb935b13b48b80b +hmac: 17811add241edae457584ba78389886df02b5e51820d826ef5fb2d97de2430e2 ... 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 new file mode 100644 index 00000000..07957e7c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +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) diff --git a/flake.lock b/flake.lock index c3920aa9..789fb82b 100644 --- a/flake.lock +++ b/flake.lock @@ -30,11 +30,11 @@ ] }, "locked": { - "lastModified": 1688145780, - "narHash": "sha256-dNUINvO7qM7fItWSeqL2nE/F3IHCGZEeERMkm1i4pP4=", + "lastModified": 1688307440, + "narHash": "sha256-7PTjbN+/+b799YN7Tk2SS5Vh8A0L3gBo8hmB7Y0VXug=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "43587cdb726f73b962f12028055520dbd1d7233f", + "rev": "b06bab83bdf285ea0ae3c8e145a081eb95959047", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8c6c8e12..616432b4 100644 --- a/flake.nix +++ b/flake.nix @@ -195,7 +195,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; # }; #}; }; 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/modules/terminal-life/bash/default.nix b/modules/terminal-life/bash/default.nix index 9528aee9..3d0c7311 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 @@ -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/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"')}, 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 <"$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 + ''; }); } diff --git a/overlays/overrides.nix b/overlays/overrides.nix index 7bea8fc0..37a8e0e8 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -3,6 +3,7 @@ channels: final: prev: { inherit (channels.latest) + nixd ; haskellPackages = @@ -18,4 +19,6 @@ channels: final: prev: { ; }); }); + + vimPlugins = prev.vimPlugins // {inherit (channels.latest.vimPlugins) nvim-lspconfig;}; } 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"; - }; } 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" 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 \ 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 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; diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh index 45efec25..27fff872 100755 --- a/shell/hooks/pre-commit.sh +++ b/shell/hooks/pre-commit.sh @@ -1,38 +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 -old_stash=$(git rev-parse --quiet --verify refs/stash) -git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook' -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