diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1f8ead4..dd7df12 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -16,6 +16,7 @@ jobs: with: source-url: "https://install.lix.systems/lix/lix-installer-x86_64-linux" diagnostic-endpoint: "" + - uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9 - name: Run `nix flake check` run: | nix flake check --verbose --keep-going @@ -24,6 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + - uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9 - uses: DeterminateSystems/nix-installer-action@v13 with: source-url: "https://install.lix.systems/lix/lix-installer-x86_64-linux" diff --git a/docs/book.toml b/docs/book.toml index 77ec9d4..d31b799 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -3,7 +3,7 @@ authors = ["Jalil David Salamé Messina"] language = "en" multilingual = false src = "src" -title = "Jalil's NixOS configuration modules" +title = "Jalil's NixOS configuration module" [preprocessor.toc] command = "mdbook-toc" diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 48707f4..16ff37a 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,9 +1,6 @@ # Summary -[Nix Based Configuration](./configuration-overview.md) - -- [NixOS Module Options](./nixos-options.md) -- [Neovim Module Options](./nvim-options.md) -- [Home Manager Module Options](./home-options.md) - -[Search](./search/index.html) +- [Nix Based Configuration](./configuration-overview.md) + - [NixOS Module Options](./nixos-options.md) + - [Neovim Module Options](./nvim-options.md) + - [Home Manager Module Options](./home-options.md) diff --git a/example-vm/default.nix b/example-vm/default.nix index ab7a40b..89ed84e 100644 --- a/example-vm/default.nix +++ b/example-vm/default.nix @@ -16,7 +16,6 @@ home = { username = "jdoe"; homeDirectory = "/home/jdoe"; - stateVersion = "24.11"; }; jhome = { enable = true; diff --git a/flake-modules/docs.nix b/flake-modules/docs.nix index d296e38..76ffb19 100644 --- a/flake-modules/docs.nix +++ b/flake-modules/docs.nix @@ -1,50 +1,46 @@ -{ lib, ... }: +{ lib, inputs, ... }: { perSystem = - { inputs', pkgs, ... }: + { pkgs, ... }: { packages = let + modules = ../modules; filterVisible = toplevelOption: option: option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; }; - genOptionsDoc = - toplevelOption: module: - pkgs.nixosOptionsDoc { - inherit (lib.evalModules { modules = [ module ]; }) options; - transformOptions = filterVisible toplevelOption; + home-eval = lib.evalModules { + modules = [ (modules + "/hm/options.nix") ]; + specialArgs = { + inherit pkgs; }; - mkScope = name: options: { - inherit name; - optionsJSON = "${options.optionsJSON}/share/doc/nixos/options.json"; - urlPrefix = "https://github.com/jalil-salame/configuration.nix/blob/main/"; }; - search = inputs'.nuschtosSearch.packages.mkMultiSearch { - title = "Search Jalil's configuration.nix"; - baseHref = "/"; - - scopes = [ - (mkScope "NixOS" nixos) - (mkScope "Home-Manager" home) - (mkScope "NixVIM" nvim) - ]; - }; - home = genOptionsDoc "jhome" ../modules/hm/options.nix; - nvim = genOptionsDoc "jhome" ../modules/nixvim/options.nix; - nixos = genOptionsDoc "jconfig" ../modules/nixos/options.nix; - nixos-markdown = nixos.optionsCommonMark; - home-markdown = home.optionsCommonMark; - nvim-markdown = nvim.optionsCommonMark; + nvim-eval = lib.evalModules { modules = [ (modules + "/nixvim/options.nix") ]; }; + nixos-eval = lib.evalModules { modules = [ (modules + "/nixos/options.nix") ]; }; + home-markdown = + (pkgs.nixosOptionsDoc { + inherit (home-eval) options; + transformOptions = filterVisible "jhome"; + }).optionsCommonMark; + nvim-markdown = + (pkgs.nixosOptionsDoc { + inherit (nvim-eval) options; + transformOptions = filterVisible "jhome"; + }).optionsCommonMark; + nixos-markdown = + (pkgs.nixosOptionsDoc { + inherit (nixos-eval) options; + transformOptions = filterVisible "jconfig"; + }).optionsCommonMark; in { - inherit search; docs-home-markdown = home-markdown; docs-nixos-markdown = nixos-markdown; docs-nvim-markdown = nvim-markdown; # Documentation docs = pkgs.stdenvNoCC.mkDerivation { name = "nixos-configuration-book"; - src = ../docs; + src = inputs.self + "/docs"; patchPhase = '' cleanup_md() { @@ -57,12 +53,10 @@ cleanup_md ${home-markdown} >> ./src/home-options.md cleanup_md ${nvim-markdown} >> ./src/nvim-options.md cleanup_md ${nixos-markdown} >> ./src/nixos-options.md - # link search site - ln -s "${search.override { baseHref = "/configuration.nix/search/"; }}" ./src/search - ''; # FIXME: only add the `/configuration.nix/` part for GH CI + ''; nativeBuildInputs = [ pkgs.mdbook-toc ]; - buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir \"$out\""; + buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out"; }; }; }; diff --git a/flake-modules/example-vm.nix b/flake-modules/example-vm.nix index b21085d..d6b88de 100644 --- a/flake-modules/example-vm.nix +++ b/flake-modules/example-vm.nix @@ -12,7 +12,7 @@ in modules = [ inputs.self.nixosModules.default ../example-vm # import vm configuration - { nix.registry.nixpkgs.flake = inputs.nixpkgs; } # pin nixpkgs to the one used by the system + { nix.registry.nixpkgs.flake = inputs.nixpkgs; } ]; }; diff --git a/flake.lock b/flake.lock index a494396..ba3e58a 100644 --- a/flake.lock +++ b/flake.lock @@ -226,11 +226,11 @@ ] }, "locked": { - "lastModified": 1743387206, - "narHash": "sha256-24N3NAuZZbYqZ39NgToZgHUw6M7xHrtrAm18kv0+2Wo=", + "lastModified": 1742234739, + "narHash": "sha256-zFL6zsf/5OztR1NSNQF33dvS1fL/BzVUjabZq4qrtY4=", "owner": "nix-community", "repo": "home-manager", - "rev": "15c5f9d04fabd176f30286c8f52bbdb2c853a146", + "rev": "f6af7280a3390e65c2ad8fd059cdc303426cbd59", "type": "github" }, "original": { @@ -240,44 +240,18 @@ "type": "github" } }, - "ixx": { - "inputs": { - "flake-utils": [ - "nuschtosSearch", - "flake-utils" - ], - "nixpkgs": [ - "nuschtosSearch", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1729958008, - "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", - "owner": "NuschtOS", - "repo": "ixx", - "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "ref": "v0.0.6", - "repo": "ixx", - "type": "github" - } - }, "lix": { "flake": false, "locked": { "lastModified": 1737234286, - "narHash": "sha256-pgDJZjj4jpzkFxsqBTI/9Yb0n3gW+DvDtuv9SwQZZcs=", - "rev": "079528098f5998ba13c88821a2eca1005c1695de", + "narHash": "sha256-CCKIAE84dzkrnlxJCKFyffAxP3yfsOAbdvydUGqq24g=", + "rev": "2837da71ec1588c1187d2e554719b15904a46c8b", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/079528098f5998ba13c88821a2eca1005c1695de.tar.gz?rev=079528098f5998ba13c88821a2eca1005c1695de" + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2837da71ec1588c1187d2e554719b15904a46c8b.tar.gz?rev=2837da71ec1588c1187d2e554719b15904a46c8b" }, "original": { "type": "tarball", - "url": "https://git.lix.systems/lix-project/lix/archive/release-2.92.tar.gz" + "url": "https://git.lix.systems/lix-project/lix/archive/2.92.0.tar.gz" } }, "lix-module": { @@ -290,15 +264,15 @@ ] }, "locked": { - "lastModified": 1742943028, - "narHash": "sha256-fprwZKE1uMzO9tiWWOrmLWBW3GPkMayQfb0xOvVFIno=", - "rev": "3fae818597ca2f1474de62022f850c23be50528d", + "lastModified": 1737237494, + "narHash": "sha256-YMLrcBpf0TR5r/eaqm8lxzFPap2TxCor0ZGcK3a7+b8=", + "rev": "b90bf629bbd835e61f1317b99e12f8c831017006", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/3fae818597ca2f1474de62022f850c23be50528d.tar.gz?rev=3fae818597ca2f1474de62022f850c23be50528d" + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/b90bf629bbd835e61f1317b99e12f8c831017006.tar.gz?rev=b90bf629bbd835e61f1317b99e12f8c831017006" }, "original": { "type": "tarball", - "url": "https://git.lix.systems/lix-project/nixos-module/archive/release-2.92.tar.gz" + "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0.tar.gz" } }, "niri": { @@ -347,11 +321,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1743367904, - "narHash": "sha256-sOos1jZGKmT6xxPvxGQyPTApOunXvScV4lNjBCXd/CI=", + "lastModified": 1742388435, + "narHash": "sha256-GheQGRNYAhHsvPxWVOhAmg9lZKkis22UPbEHlmZMthg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7ffe0edc685f14b8c635e3d6591b0bbb97365e6c", + "rev": "b75693fb46bfaf09e662d09ec076c5a162efa9f6", "type": "github" }, "original": { @@ -363,11 +337,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1742800061, - "narHash": "sha256-oDJGK1UMArK52vcW9S5S2apeec4rbfNELgc50LqiPNs=", + "lastModified": 1742272065, + "narHash": "sha256-ud8vcSzJsZ/CK+r8/v0lyf4yUntVmDq6Z0A41ODfWbE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1750f3c1c89488e2ffdd47cab9d05454dddfb734", + "rev": "3549532663732bfd89993204d40543e9edaec4f2", "type": "github" }, "original": { @@ -386,11 +360,11 @@ "nuschtosSearch": [] }, "locked": { - "lastModified": 1743362786, - "narHash": "sha256-XbXIRDbb8/vLBX1M096l7lM5wfzBTp1ZXfUl9bUhVGU=", + "lastModified": 1742488644, + "narHash": "sha256-vXpu7G4aupNCPlv8kAo7Y/jocfSUwglkvNx5cR0XjBo=", "owner": "nix-community", "repo": "nixvim", - "rev": "d81f37256d0a8691b837b74979d27bf89be8ecdd", + "rev": "d44b33a1ea1a3e584a8c93164dbe0ba2ad4f3a13", "type": "github" }, "original": { @@ -399,31 +373,6 @@ "type": "github" } }, - "nuschtosSearch": { - "inputs": { - "flake-utils": [ - "lix-module", - "flake-utils" - ], - "ixx": "ixx", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1743201766, - "narHash": "sha256-bb/dqoIjtIWtJRzASOe8g4m8W2jUIWtuoGPXdNjM/Tk=", - "owner": "NuschtOS", - "repo": "search", - "rev": "2651dbfad93d6ef66c440cbbf23238938b187bde", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "repo": "search", - "type": "github" - } - }, "root": { "inputs": { "flake-parts": "flake-parts", @@ -432,7 +381,6 @@ "niri": "niri", "nixpkgs": "nixpkgs", "nixvim": "nixvim", - "nuschtosSearch": "nuschtosSearch", "stylix": "stylix", "systems": "systems", "treefmt-nix": "treefmt-nix", @@ -556,11 +504,11 @@ ] }, "locked": { - "lastModified": 1743081648, - "narHash": "sha256-WRAylyYptt6OX5eCEBWyTwOEqEtD6zt33rlUkr6u3cE=", + "lastModified": 1742370146, + "narHash": "sha256-XRE8hL4vKIQyVMDXykFh4ceo3KSpuJF3ts8GKwh5bIU=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "29a3d7b768c70addce17af0869f6e2bd8f5be4b7", + "rev": "adc195eef5da3606891cedf80c0d9ce2d3190808", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5f68856..6f6c265 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,7 @@ unstable.follows = "nixvim/nixpkgs"; # Lix lix-module = { - url = "https://git.lix.systems/lix-project/nixos-module/archive/release-2.92.tar.gz"; + url = "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0.tar.gz"; inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.inputs.systems.follows = "systems"; @@ -58,19 +58,10 @@ url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; - # For the formatter (can be set to null) treefmt-nix = { url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - # For generating the docs (can be set to null) - nuschtosSearch = { - url = "github:NuschtOS/search"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "lix-module/flake-utils"; - }; - }; # For deduplication systems.url = "github:nix-systems/default"; }; diff --git a/modules/hm/default.nix b/modules/hm/default.nix index 3f31f26..0f1e59a 100644 --- a/modules/hm/default.nix +++ b/modules/hm/default.nix @@ -16,7 +16,6 @@ in imports = [ ./options.nix ./gui - ./dev.nix ./users.nix ]; @@ -24,7 +23,7 @@ in (lib.mkIf (cfg.enable && cfg.styling.enable) { stylix = { enable = true; - targets.nixvim.enable = false; # I prefer styling it myself + targets.nixvim.enable = false; # I prefer doing it myself }; }) (lib.mkIf cfg.enable { @@ -36,7 +35,6 @@ in "settings" "use-xdg-base-directories" ] true; - programs = { # Better cat (bat) bat = { @@ -58,11 +56,6 @@ in git = true; icons = "auto"; }; - # Shell - fish = { - enable = true; - preferAbbrs = true; # when defining an alias, prefer instead to define an abbreviation - }; # GnuPG gpg = { enable = true; @@ -80,8 +73,17 @@ in ssh.enable = true; # cd replacement zoxide.enable = true; + # Shell + zsh = { + enable = true; + autosuggestion.enable = true; + enableCompletion = true; + autocd = true; + dotDir = ".config/zsh"; + history.path = "${config.xdg.dataHome}/zsh/zsh_history"; + syntaxHighlighting.enable = true; + }; }; - services = { # GPG Agent gpg-agent = { @@ -101,8 +103,9 @@ in }; }; }; - home = { + stateVersion = "22.11"; + # Extra packages # Extra variables sessionVariables = { CARGO_HOME = "${config.xdg.dataHome}/cargo"; @@ -124,7 +127,6 @@ in tree = "eza --tree"; }; }; - # XDG directories xdg = { enable = true; @@ -134,5 +136,86 @@ in }; }; }) + (lib.mkIf (cfg.enable && devcfg.enable) { + home = { + sessionVariables.MANPAGER = lib.optionalString devcfg.neovimAsManPager "nvim -c 'Man!' -o -"; + packages = devcfg.extraPackages; + }; + # Github CLI + programs = { + gh.enable = true; + gh-dash.enable = true; + # Git + git = { + enable = true; + difftastic = { + enable = true; + background = "dark"; + }; + lfs.enable = true; + extraConfig = { + # Add diff to the commit message editor + commit.verbose = true; + # Improve submodule diff + diff.submodule = "log"; + # Set the default branch name for new branches + init.defaultBranch = "main"; + # Better conflicts (also shows parent commit state) + merge.conflictStyle = "zdiff3"; + # Do not create merge commits when pulling (rebase but abort on conflict) + pull.ff = "only"; + # Use `--set-upstream` if the remote does not have the branch + push.autoSetupRemote = true; + rebase = { + # If there are uncommitted changes, stash them before rebasing + autoStash = true; + # If there are fixup! commits, squash them while rebasing + autoSquash = true; + }; + # Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts + rerere.enabled = true; + # Improve submodule status + status.submoduleSummary = true; + }; + }; + lazygit.enable = true; + # Jujutsu (alternative DVCS (git-compatible)) + jujutsu = { + enable = true; + package = pkgs.unstable.jujutsu; + settings = { + ui.pager = "bat"; + # mimic git commit --verbose by adding a diff + templates.draft_commit_description = '' + concat( + description, + surround( + "\nJJ: This commit contains the following changes:\n", "", + indent("JJ: ", diff.stat(72)), + ), + surround( + "\nJJ: Diff:\n", "", + indent("JJ: ", diff.git()), + ), + ) + ''; + }; + }; + }; + }) + (lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) { + home.packages = [ pkgs.rustup ] ++ devcfg.rust.extraPackages; + # Background code checker (for Rust) + programs.bacon = { + enable = true; + settings = { + export = { + enabled = true; + path = ".bacon-locations"; + line_format = "{kind} {path}:{line}:{column} {message}"; + }; + }; + }; + }) ]; } diff --git a/modules/hm/dev.nix b/modules/hm/dev.nix deleted file mode 100644 index 5e58c72..0000000 --- a/modules/hm/dev.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -let - cfg = config.jhome.dev; -in -{ - config = - lib.flip lib.pipe - [ - lib.mkMerge - (lib.mkIf (config.jhome.enable && cfg.enable)) - ] - [ - (lib.mkIf cfg.rust.enable { - home.packages = [ pkgs.rustup ] ++ cfg.rust.extraPackages; - # Background code checker (for Rust) - programs.bacon = { - enable = true; - settings = { - export = { - enabled = true; - path = ".bacon-locations"; - line_format = "{kind} {path}:{line}:{column} {message}"; - }; - }; - }; - }) - { - home = { - sessionVariables.MANPAGER = lib.optionalString cfg.neovimAsManPager "nvim -c 'Man!' -o -"; - packages = cfg.extraPackages; - }; - - # Github CLI - programs = { - gh.enable = true; - gh-dash.enable = true; - # Git - git = { - enable = true; - difftastic = { - enable = true; - background = "dark"; - }; - lfs.enable = true; - extraConfig = { - # Add diff to the commit message editor - commit.verbose = true; - # Improve submodule diff - diff.submodule = "log"; - # Set the default branch name for new branches - init.defaultBranch = "main"; - # Better conflicts (also shows parent commit state) - merge.conflictStyle = "zdiff3"; - # Do not create merge commits when pulling (rebase but abort on conflict) - pull.ff = "only"; - # Use `--set-upstream` if the remote does not have the branch - push.autoSetupRemote = true; - rebase = { - # If there are uncommitted changes, stash them before rebasing - autoStash = true; - # If there are fixup! commits, squash them while rebasing - autoSquash = true; - }; - # Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts - rerere.enabled = true; - # Improve submodule status - status.submoduleSummary = true; - }; - }; - lazygit.enable = true; - # Jujutsu (alternative DVCS (git-compatible)) - jujutsu = { - enable = true; - package = pkgs.unstable.jujutsu; - settings = { - ui.pager = "bat"; - # mimic git commit --verbose by adding a diff - templates.draft_commit_description = '' - concat( - description, - surround( - "\nJJ: This commit contains the following changes:\n", "", - indent("JJ: ", diff.stat(72)), - ), - surround( - "\nJJ: Diff:\n", "", - indent("JJ: ", diff.git()), - ), - ) - ''; - }; - }; - }; - } - ]; -} diff --git a/modules/hm/gui/default.nix b/modules/hm/gui/default.nix index d885697..00d70ea 100644 --- a/modules/hm/gui/default.nix +++ b/modules/hm/gui/default.nix @@ -129,13 +129,13 @@ in # PDF reader zathura.enable = true; # Auto start sway - fish.loginShellInit = - lib.optionalString cfg.sway.autostart # fish + zsh.loginExtra = + lib.optionalString cfg.sway.autostart # sh '' # Start Sway on login to TTY 1 - if test "$(tty)" = /dev/tty1 + if [ "$TTY" = /dev/tty1 ]; then exec sway - end + fi ''; }; services = { diff --git a/modules/hm/gui/keybindings.nix b/modules/hm/gui/keybindings.nix index cfc8788..867be55 100644 --- a/modules/hm/gui/keybindings.nix +++ b/modules/hm/gui/keybindings.nix @@ -93,7 +93,7 @@ builtins.foldl' (l: r: l // r) "XF86AudioRaiseVolume" = "exec ${pkgs.avizo}/bin/volumectl up"; "XF86AudioLowerVolume" = "exec ${pkgs.avizo}/bin/volumectl down"; "XF86AudioMute" = "exec ${pkgs.avizo}/bin/volumectl toggle-mute"; - "XF86ScreenSaver" = "exec ${pkgs.swaylock}/bin/swaylock --image ${cfg.background}"; + "XF86ScreenSaver" = "exec swaylock --image ${cfg.background}"; "XF86MonBrightnessUp" = "exec ${pkgs.avizo}/bin/lightctl up"; "XF86MonBrightnessDown" = "exec ${pkgs.avizo}/bin/lightctl down"; # Floating diff --git a/modules/hm/users.nix b/modules/hm/users.nix index 702e60c..acbf9a8 100644 --- a/modules/hm/users.nix +++ b/modules/hm/users.nix @@ -4,12 +4,15 @@ let inherit (cfg.defaultIdentity) signingKey; cfg = jhome.user; + hasConfig = jhome.enable && cfg != null; hasKey = signingKey != null; + gpgHome = config.programs.gpg.homedir; + unlockKey = hasConfig && cfg.gpg.unlockKeys != [ ]; in { - config = lib.mkIf (jhome.enable && cfg != null) { - programs = { - git = { + config = lib.mkMerge [ + (lib.mkIf hasConfig { + programs.git = { userName = cfg.defaultIdentity.name; userEmail = cfg.defaultIdentity.email; signing = lib.mkIf hasKey { @@ -17,8 +20,7 @@ in key = signingKey; }; }; - - jujutsu.settings = { + programs.jujutsu.settings = { user = lib.mkIf (cfg.defaultIdentity != null) { inherit (cfg.defaultIdentity) name email; }; git.sign-on-push = lib.mkDefault hasKey; signing = lib.mkIf hasKey { @@ -27,14 +29,14 @@ in key = signingKey; }; }; - }; + }) + (lib.mkIf unlockKey { + xdg.configFile.pam-gnupg.text = + '' + ${gpgHome} - xdg.configFile.pam-gnupg = lib.mkIf (cfg.gpg.unlockKeys != [ ]) { - text = '' - ${config.programs.gpg.homedir} - - ${lib.strings.concatLines cfg.gpg.unlockKeys} - ''; - }; - }; + '' + + (lib.strings.concatLines cfg.gpg.unlockKeys); + }) + ]; } diff --git a/modules/lib.nix b/modules/lib.nix deleted file mode 100644 index 3e3a288..0000000 --- a/modules/lib.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib }: -let - inherit (lib) types; -in -{ - # Like mkEnableOption but defaults to true - mkDisableOption = - option: - (lib.mkEnableOption option) - // { - default = true; - example = false; - }; - # A option that accepts an image (and shows it in the docs) - mkImageOption = - { - description, - url, - sha256 ? "", - }: - lib.mkOption { - inherit description; - type = types.path; - default = builtins.fetchurl { inherit url sha256; }; - defaultText = lib.literalMD "![${description}](${url})"; - }; -} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index d6eeff7..58eb1e4 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,6 +1,11 @@ -{ pkgs, lib, ... }@args: +{ + config, + pkgs, + lib, + ... +}: let - cfg = args.config.jconfig; + cfg = config.jconfig; keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: { name = "pubkeys/${username}"; value = { @@ -15,96 +20,108 @@ in { imports = [ ./options.nix - ./dev.nix - ./gui.nix - ./styling.nix + ./gui + { stylix = import ./stylix-config.nix { inherit config pkgs; }; } ]; - config = lib.mkIf cfg.enable { - # Enable unlocking the gpg-agent at boot (configured through home.nix) - security.pam.services.login.gnupg.enable = true; + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + boot.plymouth = { + inherit (cfg.styling) enable; + }; - environment.systemPackages = [ - # CLI tools - pkgs.fd - pkgs.ripgrep - pkgs.du-dust - pkgs.curl - pkgs.zip - pkgs.unzip - ]; + # Enable unlocking the gpg-agent at boot (configured through home.nix) + security.pam.services.login.gnupg.enable = true; - programs = { - # Launch fish if shell is interactive (from https://wiki.nixos.org/wiki/Fish) - bash.interactiveShellInit = # bash - '' - if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] - then - shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION - fi - ''; - # Default shell - fish.enable = true; - # Shell prompt - starship = { - enable = true; - settings = lib.mkMerge [ - { - format = "$time$all"; - add_newline = false; - cmd_duration.min_time = 500; - cmd_duration.show_milliseconds = true; - time.disabled = false; - status = { - format = "[$signal_name$common_meaning$maybe_int](red)"; - symbol = "[✗](bold red)"; - disabled = false; - }; - sudo.disabled = false; - } - # Add nerdfont symbols - (lib.mkIf cfg.styling.enable (import ./starship-nerdfont-symbols.nix)) - # Remove the `in`s and `on`s from the prompt - (import ./starship-shorter-text.nix) + environment.systemPackages = [ + # CLI tools + pkgs.fd + pkgs.ripgrep + pkgs.du-dust + pkgs.curl + pkgs.zip + pkgs.unzip ]; - }; - }; - environment.etc = keysFromGithub; - services = { - # Enable printer autodiscovery if printing is enabled - avahi = { - inherit (args.config.services.printing) enable; - nssmdns4 = true; - openFirewall = true; - }; - openssh.authorizedKeysFiles = builtins.map (keys: "/etc/${keys}") ( - builtins.attrNames keysFromGithub - ); - }; - # Open ports for spotifyd - networking.firewall = { - allowedUDPPorts = [ 5353 ]; - allowedTCPPorts = [ 2020 ]; - }; - # Nix Settings - nix = { - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - # run between 0 and 45min after boot if run was missed - randomizedDelaySec = "45min"; - }; - settings = { - use-xdg-base-directories = true; - auto-optimise-store = true; - experimental-features = [ - "nix-command" - "flakes" - ]; - }; - }; - }; + # Enable dev documentation + documentation.dev = { + inherit (cfg.dev) enable; + }; + programs = { + # Shell prompt + starship = { + enable = true; + settings = lib.mkMerge [ + { + format = "$time$all"; + add_newline = false; + cmd_duration.min_time = 500; + cmd_duration.show_milliseconds = true; + time.disabled = false; + status = { + format = "[$signal_name$common_meaning$maybe_int](red)"; + symbol = "[✗](bold red)"; + disabled = false; + }; + sudo.disabled = false; + } + # Add nerdfont symbols + (lib.mkIf cfg.styling.enable (import ./starship-nerdfont-symbols.nix)) + # Remove the `in`s and `on`s from the prompt + (lib.mkIf cfg.styling.enable (import ./starship-shorter-text.nix)) + ]; + }; + # Default shell + zsh.enable = true; + }; + + environment.etc = keysFromGithub; + services = { + # Enable printer autodiscovery if printing is enabled + avahi = { + inherit (config.services.printing) enable; + nssmdns4 = true; + openFirewall = true; + }; + openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") ( + builtins.attrNames keysFromGithub + ); + }; + users.defaultUserShell = pkgs.zsh; + # Open ports for spotifyd + networking.firewall = { + allowedUDPPorts = [ 5353 ]; + allowedTCPPorts = [ 2020 ]; + }; + # Nix Settings + nix = { + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + # run between 0 and 45min after boot if run was missed + randomizedDelaySec = "45min"; + }; + settings = { + use-xdg-base-directories = true; + auto-optimise-store = true; + experimental-features = [ + "nix-command" + "flakes" + ]; + }; + }; + } + # dev configuration + (lib.mkIf cfg.dev.enable { + users.extraUsers = lib.mkIf cfg.dev.jupyter.enable { jupyter.group = "jupyter"; }; + services.jupyter = { + inherit (cfg.dev.jupyter) enable; + group = "jupyter"; + user = "jupyter"; + }; + }) + ] + ); } diff --git a/modules/nixos/dev.nix b/modules/nixos/dev.nix deleted file mode 100644 index b4aee84..0000000 --- a/modules/nixos/dev.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.jconfig.dev; -in -{ - config = lib.mkIf (config.jconfig.enable && cfg.enable) { - # Enable dev documentation - documentation.dev = { inherit (cfg) enable; }; - - users.extraUsers = lib.mkIf cfg.jupyter.enable { jupyter.group = "jupyter"; }; - - services.jupyter = { - inherit (cfg.jupyter) enable; - group = "jupyter"; - user = "jupyter"; - }; - }; -} diff --git a/modules/nixos/gui.nix b/modules/nixos/gui.nix deleted file mode 100644 index d07f706..0000000 --- a/modules/nixos/gui.nix +++ /dev/null @@ -1,117 +0,0 @@ -{ lib, pkgs, ... }@args: -let - cfg = args.config.jconfig.gui; - enable = args.config.jconfig.enable && cfg.enable; - linuxOlderThan6_3 = lib.versionOlder args.config.boot.kernelPackages.kernel.version "6.3"; -in -{ - config = - lib.flip lib.pipe - [ lib.mkMerge (lib.mkIf enable) ] - [ - { - environment.systemPackages = [ - pkgs.adwaita-icon-theme - pkgs.adwaita-qt - pkgs.nordzy-cursor-theme - pkgs.pinentry-qt - ]; - # Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851 - systemd.user.extraConfig = '' - DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" - ''; - - fonts.fontDir.enable = true; - programs = { - dconf.enable = true; - sway = { - enable = cfg.sway; - # No extra packages (by default it adds foot, dmenu, and other stuff) - extraPackages = [ ]; - wrapperFeatures = { - base = true; - gtk = true; - }; - }; - }; - security = { - polkit.enable = true; - rtkit.enable = true; # Recommended for pipewire - }; - services = { - flatpak.enable = true; - # Audio - pipewire = { - enable = true; - alsa = { - enable = true; - support32Bit = true; - }; - pulse.enable = true; - wireplumber.enable = true; - }; - # Dbus - dbus.enable = true; - # Virtual Filesystem (for PCManFM) - gvfs.enable = true; - }; - xdg.portal = { - # XDG portals - enable = true; - wlr.enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - config.preferred = { - # Default to the gtk portal - default = "gtk"; - # Use wlr for screenshots and screen recording - "org.freedesktop.impl.portal.Screenshot" = "wlr"; - }; - # Consider using darkman like upstream - }; - hardware = { - graphics.enable = true; - uinput.enable = true; - steam-hardware.enable = cfg.steamHardwareSupport; - }; - } - (lib.mkIf cfg.ydotool.enable { - environment.systemPackages = [ pkgs.ydotool ]; - systemd.user.services.ydotool = { - enable = cfg.ydotool.autoStart; - wantedBy = [ "default.target" ]; - description = "Generic command-line automation tool"; - documentation = [ - "man:ydotool(1)" - "man:ydotoold(8)" - ]; - serviceConfig = { - Type = "simple"; - Restart = "always"; - ExecStart = "${pkgs.ydotool}/bin/ydotoold"; - ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID"; - KillMode = "process"; - TimeoutSec = 180; - }; - }; - }) - (lib.mkIf (linuxOlderThan6_3 && cfg."8bitdoFix") { - # Udev rules to start or stop systemd service when controller is connected or disconnected - services.udev.extraRules = # udev - '' - # May vary depending on your controller model, find product id using 'lsusb' - SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3106", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl start 8bitdo-ultimate-xinput@2dc8:3106" - # This device (2dc8:3016) is "connected" when the above device disconnects - SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3016", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl stop 8bitdo-ultimate-xinput@2dc8:3106" - ''; - - # Systemd service which starts xboxdrv in xbox360 mode - systemd.services."8bitdo-ultimate-xinput@" = { - unitConfig.Description = "8BitDo Ultimate Controller XInput mode xboxdrv daemon"; - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.xboxdrv}/bin/xboxdrv --mimic-xpad --silent --type xbox360 --device-by-id %I --force-feedback"; - }; - }; - }) - ]; -} diff --git a/modules/nixos/gui/default.nix b/modules/nixos/gui/default.nix new file mode 100644 index 0000000..52d17b8 --- /dev/null +++ b/modules/nixos/gui/default.nix @@ -0,0 +1,118 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.jconfig.gui; + enable = config.jconfig.enable && cfg.enable; + linuxOlderThan6_3 = lib.versionOlder config.boot.kernelPackages.kernel.version "6.3"; +in +{ + config = lib.mkMerge [ + (lib.mkIf enable { + environment.systemPackages = [ + pkgs.adwaita-icon-theme + pkgs.adwaita-qt + pkgs.nordzy-cursor-theme + pkgs.pinentry-qt + ] ++ lib.optional cfg.ydotool.enable pkgs.ydotool; + systemd = { + user.services.ydotool = lib.mkIf cfg.ydotool.enable { + enable = cfg.ydotool.autoStart; + wantedBy = [ "default.target" ]; + description = "Generic command-line automation tool"; + documentation = [ + "man:ydotool(1)" + "man:ydotoold(8)" + ]; + serviceConfig = { + Type = "simple"; + Restart = "always"; + ExecStart = "${pkgs.ydotool}/bin/ydotoold"; + ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID"; + KillMode = "process"; + TimeoutSec = 180; + }; + }; + # Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851 + user.extraConfig = '' + DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" + ''; + }; + + fonts.fontDir.enable = true; + programs = { + dconf.enable = true; + sway = { + enable = cfg.sway; + # No extra packages (by default it adds foot, dmenu, and other stuff) + extraPackages = [ ]; + wrapperFeatures = { + base = true; + gtk = true; + }; + }; + }; + security = { + polkit.enable = true; + rtkit.enable = true; # Recommended for pipewire + }; + services = { + flatpak.enable = true; + # Audio + pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + wireplumber.enable = true; + }; + # Dbus + dbus.enable = true; + # Virtual Filesystem (for PCManFM) + gvfs.enable = true; + }; + xdg.portal = { + # XDG portals + enable = true; + wlr.enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + config.preferred = { + # Default to the gtk portal + default = "gtk"; + # Use wlr for screenshots and screen recording + "org.freedesktop.impl.portal.Screenshot" = "wlr"; + }; + # Consider using darkman like upstream + }; + hardware = { + graphics.enable = true; + uinput.enable = true; + steam-hardware.enable = cfg.steamHardwareSupport; + }; + }) + (lib.mkIf (enable && linuxOlderThan6_3 && cfg."8bitdoFix") { + # Udev rules to start or stop systemd service when controller is connected or disconnected + services.udev.extraRules = # udev + '' + # May vary depending on your controller model, find product id using 'lsusb' + SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3106", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl start 8bitdo-ultimate-xinput@2dc8:3106" + # This device (2dc8:3016) is "connected" when the above device disconnects + SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3016", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl stop 8bitdo-ultimate-xinput@2dc8:3106" + ''; + + # Systemd service which starts xboxdrv in xbox360 mode + systemd.services."8bitdo-ultimate-xinput@" = { + unitConfig.Description = "8BitDo Ultimate Controller XInput mode xboxdrv daemon"; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.xboxdrv}/bin/xboxdrv --mimic-xpad --silent --type xbox360 --device-by-id %I --force-feedback"; + }; + }; + }) + ]; +} diff --git a/modules/nixos/options.nix b/modules/nixos/options.nix index d8b4e64..9e76f1c 100644 --- a/modules/nixos/options.nix +++ b/modules/nixos/options.nix @@ -1,95 +1,106 @@ { lib, ... }: let inherit (lib) types; - inherit (import ../lib.nix { inherit lib; }) - mkDisableOption - mkImageOption - ; + # Like mkEnableOption but defaults to true + mkDisableOption = + option: + (lib.mkEnableOption option) + // { + default = true; + example = false; + }; + mkImageOption = + { + description, + url, + sha256 ? "", + }: + lib.mkOption { + inherit description; + type = types.path; + default = builtins.fetchurl { inherit url sha256; }; + defaultText = lib.literalMD "![${description}](${url})"; + }; + + gui.options = { + enable = lib.mkEnableOption "jalil's default gui configuration."; + # Fix for using Xinput mode on 8bitdo Ultimate C controller + # Inspired by https://aur.archlinux.org/packages/8bitdo-ultimate-controller-udev + # Adapted from: https://gist.github.com/interdependence/28452fbfbe692986934fbe1e54c920d4 + "8bitdoFix" = mkDisableOption "a fix for 8bitdo controllers"; + steamHardwareSupport = mkDisableOption "steam hardware support"; + ydotool = lib.mkOption { + description = "Jalil's default ydotool configuration."; + default = { }; + type = types.submodule { + options.enable = mkDisableOption "ydotool"; + options.autoStart = mkDisableOption "autostarting ydotool at login"; + }; + }; + sway = mkDisableOption "sway"; + }; + + styling.options = { + enable = mkDisableOption "jalil's default styling (disables stylix)"; + wallpaper = mkImageOption { + description = "The wallpaper to use."; + url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png"; + sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc"; + }; + bootLogo = mkImageOption { + description = "The logo used by plymouth at boot."; + # http://xenia-linux-site.glitch.me/images/cathodegaytube-splash.png + url = "https://efimero.github.io/xenia-images/cathodegaytube-splash.png"; + sha256 = "qKugUfdRNvMwSNah+YmMepY3Nj6mWlKFh7jlGlAQDo8="; + }; + }; + + config.options = { + enable = lib.mkEnableOption "jalil's default configuration."; + dev = lib.mkOption { + description = "Options for setting up a dev environment"; + default = { }; + type = types.submodule { + options.enable = lib.mkEnableOption "dev configuration"; + options.jupyter.enable = lib.mkEnableOption "jupyter configuration"; + }; + }; + gui = lib.mkOption { + description = "Jalil's default configuration for a NixOS gui."; + default = { }; + type = types.submodule gui; + }; + styling = lib.mkOption { + description = "Jalil's styling options"; + default = { }; + type = types.submodule styling; + }; + importSSHKeysFromGithub = lib.mkOption { + description = '' + Import public ssh keys from a github username. + + This will fetch the keys from https://github.com/$${username}.keys. + + The format is `"$${github-username}" = $${sha256-hash}`. The example + will try to fetch the keys from . + + **Warning**: this will interfere with services like gitea that override + the default ssh behaviour. In that case you want to use + `users.users..openssh.authorizedKeys.keyFiles` on the users you + want to allow ssh logins. + ''; + default = { }; + example = { + "jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + }; + type = types.attrsOf types.str; + }; + }; in { options.jconfig = lib.mkOption { description = "Jalil's default NixOS configuration."; default = { }; - type = types.submodule { - options = { - enable = lib.mkEnableOption "jalil's default configuration."; - importSSHKeysFromGithub = lib.mkOption { - description = '' - Import public ssh keys from a github username. - - This will fetch the keys from https://github.com/$${username}.keys. - - The format is `"$${github-username}" = $${sha256-hash}`. The example - will try to fetch the keys from . - - **Warning**: this will interfere with services like gitea that override - the default ssh behaviour. In that case you want to use - `users.users..openssh.authorizedKeys.keyFiles` on the users you - want to allow ssh logins. - ''; - default = { }; - example = { - "jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; - }; - type = types.attrsOf types.str; - }; - - dev = lib.mkOption { - description = "Options for setting up a dev environment"; - default = { }; - type = types.submodule { - options = { - enable = lib.mkEnableOption "dev configuration"; - jupyter.enable = lib.mkEnableOption "jupyter configuration"; - }; - }; - }; - - gui = lib.mkOption { - description = "Jalil's default configuration for a NixOS gui."; - default = { }; - type = types.submodule { - options = { - enable = lib.mkEnableOption "jalil's default gui configuration."; - # Fix for using Xinput mode on 8bitdo Ultimate C controller - # Inspired by https://aur.archlinux.org/packages/8bitdo-ultimate-controller-udev - # Adapted from: https://gist.github.com/interdependence/28452fbfbe692986934fbe1e54c920d4 - "8bitdoFix" = mkDisableOption "a fix for 8bitdo controllers"; - steamHardwareSupport = mkDisableOption "steam hardware support"; - ydotool = lib.mkOption { - description = "Jalil's default ydotool configuration."; - default = { }; - type = types.submodule { - options.enable = mkDisableOption "ydotool"; - options.autoStart = mkDisableOption "autostarting ydotool at login"; - }; - }; - sway = mkDisableOption "sway"; - }; - }; - }; - - styling = lib.mkOption { - description = "Jalil's styling options"; - default = { }; - type = types.submodule { - options = { - enable = mkDisableOption "jalil's default styling (disables stylix)"; - wallpaper = mkImageOption { - description = "The wallpaper to use."; - url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png"; - sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc"; - }; - bootLogo = mkImageOption { - description = "The logo used by plymouth at boot."; - # http://xenia-linux-site.glitch.me/images/cathodegaytube-splash.png - url = "https://efimero.github.io/xenia-images/cathodegaytube-splash.png"; - sha256 = "qKugUfdRNvMwSNah+YmMepY3Nj6mWlKFh7jlGlAQDo8="; - }; - }; - }; - }; - }; - }; + type = types.submodule config; }; } diff --git a/modules/nixos/styling.nix b/modules/nixos/styling.nix deleted file mode 100644 index b20a2d7..0000000 --- a/modules/nixos/styling.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ lib, pkgs, ... }@args: -let - cfg = args.config.jconfig.styling; - enable = args.config.jconfig.enable && cfg.enable; -in -{ - config = lib.mkIf enable { - boot.plymouth = { inherit (cfg) enable; }; - - stylix = { - inherit (cfg) enable; - image = cfg.wallpaper; - base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; - polarity = "dark"; - fonts = { - monospace = { - name = "JetBrains Mono"; - package = pkgs.jetbrains-mono; - }; - sansSerif = { - name = "Noto Sans"; - package = pkgs.noto-fonts; - }; - serif = { - name = "Noto Serif"; - package = pkgs.noto-fonts; - }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - sizes.popups = 12; - }; - targets = { - plymouth = { - logoAnimated = false; - logo = cfg.bootLogo; - }; - nixvim.enable = false; - }; - }; - }; -} diff --git a/modules/nixos/stylix-config.nix b/modules/nixos/stylix-config.nix new file mode 100644 index 0000000..a4e75d8 --- /dev/null +++ b/modules/nixos/stylix-config.nix @@ -0,0 +1,36 @@ +{ config, pkgs }: +let + cfg = config.jconfig.styling; +in +{ + inherit (cfg) enable; + image = cfg.wallpaper; + base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; + polarity = "dark"; + fonts = { + monospace = { + name = "JetBrains Mono"; + package = pkgs.jetbrains-mono; + }; + sansSerif = { + name = "Noto Sans"; + package = pkgs.noto-fonts; + }; + serif = { + name = "Noto Serif"; + package = pkgs.noto-fonts; + }; + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + sizes.popups = 12; + }; + targets = { + plymouth = { + logoAnimated = false; + logo = cfg.bootLogo; + }; + nixvim.enable = false; + }; +} diff --git a/modules/nixvim/dev-plugins.nix b/modules/nixvim/dev-plugins.nix index f44c09b..7659912 100644 --- a/modules/nixvim/dev-plugins.nix +++ b/modules/nixvim/dev-plugins.nix @@ -21,7 +21,6 @@ let "typos_lsp" # "typst_lsp" # Not using it "zls" - "fish_lsp" ]; in { @@ -96,7 +95,6 @@ in pkgs.stylua pkgs.taplo pkgs.yamlfmt - pkgs.fish ]; plugins.conform-nvim = { enable = true; @@ -113,7 +111,6 @@ in toml = [ "taplo" ]; yaml = [ "yamlfmt" ]; zig = [ "zigfmt" ]; - fish = [ "fish_indent" ]; }; }; }; @@ -130,6 +127,7 @@ in # latex = [ "chktex" ]; # Not in use nix = [ "statix" ]; sh = [ "dash" ]; + zsh = [ "zsh" ]; }; }; } diff --git a/modules/nixvim/plugins.nix b/modules/nixvim/plugins.nix index 8943c56..f843db6 100644 --- a/modules/nixvim/plugins.nix +++ b/modules/nixvim/plugins.nix @@ -4,102 +4,129 @@ let in { config.plugins = { - cmp = - let - srcWithIndex = groupIndex: name: { inherit name groupIndex; }; - in - { - enable = true; - cmdline = { - "/" = { - mapping = - mkRaw - # lua - '' - cmp.mapping.preset.cmdline() - ''; - sources = [ - { name = "rg"; } - { name = "buffer"; } - ]; - }; - ":" = { - mapping = - mkRaw - # lua - "cmp.mapping.preset.cmdline()"; - sources = [ - { name = "path"; } - { name = "cmdline"; } - ]; - }; - }; - settings = { - # Snippets - snippet.expand = - # lua - "function(args) require('luasnip').lsp_expand(args.body) end"; - # Completion Sources - sources = [ - # very specific (not noisy) - (srcWithIndex 1 "calc") - (srcWithIndex 1 "crates") - (srcWithIndex 1 "fish") - (srcWithIndex 1 "luasnip") - (srcWithIndex 1 "nvim_lsp") - # Generally ok - (srcWithIndex 2 "conventionalcommits") - (srcWithIndex 2 "nvim_lsp_document_symbol") - (srcWithIndex 2 "nvim_lsp_signature_help") - # Noisy - (srcWithIndex 2 "path") - (srcWithIndex 3 "spell") - (srcWithIndex 3 "treesitter") - # Very noisy - (srcWithIndex 4 "buffer") - ]; + cmp = { + enable = true; + cmdline = { + "/" = { mapping = mkRaw # lua '' - cmp.mapping.preset.insert({ - [""] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expand_or_jumpable() then - require("luasnip").expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, - [""] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require("luasnip").jumpable(-1) then - require("luasnip").jump(-1) - else - fallback() - end - end, - [""] = cmp.mapping(function(fallback) - if require("luasnip").choice_active() then - require("luasnip").next_choice() - else - fallback() - end - end), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete { }, - [""] = cmp.mapping.close(), - [""] = cmp.mapping.confirm { select = true }, - }) + cmp.mapping.preset.cmdline() ''; + sources = [ + { name = "rg"; } + { name = "buffer"; } + ]; + }; + ":" = { + mapping = + mkRaw + # lua + '' + cmp.mapping.preset.cmdline() + ''; + sources = [ + { name = "path"; } + { name = "cmdline"; } + ]; }; }; - cmp-fish.enable = true; + settings = { + # Snippets + snippet.expand = + # lua + '' + function(args) require('luasnip').lsp_expand(args.body) end + ''; + # Completion Sources + sources = [ + { + name = "buffer"; + groupIndex = 3; + } + { + name = "calc"; + groupIndex = 2; + } + { + name = "conventionalcommits"; + groupIndex = 1; + } + { + name = "crates"; + groupIndex = 1; + } + { + name = "luasnip"; + groupIndex = 1; + } + { + name = "nvim_lsp"; + groupIndex = 1; + } + { + name = "nvim_lsp_document_symbol"; + groupIndex = 1; + } + { + name = "nvim_lsp_signature_help"; + groupIndex = 1; + } + { + name = "path"; + groupIndex = 2; + } + { + name = "spell"; + groupIndex = 2; + } + { + name = "treesitter"; + groupIndex = 2; + } + ]; + mapping = + mkRaw + # lua + '' + cmp.mapping.preset.insert({ + [""] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + require("luasnip").expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, + [""] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").next_choice() + else + fallback() + end + end), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete { }, + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { select = true }, + }) + ''; + }; + }; gitsigns.enable = true; lualine = { enable = true; diff --git a/scripts/audiomenu/Cargo.lock b/scripts/audiomenu/Cargo.lock index e783945..44304bb 100644 --- a/scripts/audiomenu/Cargo.lock +++ b/scripts/audiomenu/Cargo.lock @@ -116,9 +116,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.35" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944" +checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" dependencies = [ "clap_builder", "clap_derive", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.35" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9" +checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" dependencies = [ "anstream", "anstyle", @@ -281,9 +281,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "os_pipe" diff --git a/scripts/jpassmenu/Cargo.lock b/scripts/jpassmenu/Cargo.lock index cfd1d1d..a83122b 100644 --- a/scripts/jpassmenu/Cargo.lock +++ b/scripts/jpassmenu/Cargo.lock @@ -124,9 +124,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.35" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944" +checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" dependencies = [ "clap_builder", "clap_derive", @@ -134,9 +134,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.35" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9" +checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" dependencies = [ "anstream", "anstyle", @@ -293,9 +293,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "jiff" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c102670231191d07d37a35af3eb77f1f0dbf7a71be51a962dcd57ea607be7260" +checksum = "d699bc6dfc879fb1bf9bdff0d4c56f0884fc6f0d0eb0fba397a6d00cd9a6b85e" dependencies = [ "jiff-static", "log", @@ -306,9 +306,9 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cdde31a9d349f1b1f51a0b3714a5940ac022976f4b49485fc04be052b183b4c" +checksum = "8d16e75759ee0aa64c57a56acbf43916987b20c77373cb7e808979e02b93c9f9" dependencies = [ "proc-macro2", "quote", @@ -341,9 +341,9 @@ checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" [[package]] name = "log" -version = "0.4.27" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "memchr" @@ -402,9 +402,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "os_pipe"