From 82baec0470660494fe3e33b30d3f7b9cbfc7dbdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Sun, 2 Nov 2025 12:25:01 +0800 Subject: [PATCH] tree-wide: init fish completion module --- nix/configurations/hydrogen.nix | 9 +++++---- nix/configurations/vanadium.nix | 1 + nix/nixosModules/common/fish.nix | 22 ++++++++++++++++++++++ nix/nixosModules/extra/leana.nix | 6 ------ 4 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 nix/nixosModules/common/fish.nix diff --git a/nix/configurations/hydrogen.nix b/nix/configurations/hydrogen.nix index d0196449..2ceccff2 100644 --- a/nix/configurations/hydrogen.nix +++ b/nix/configurations/hydrogen.nix @@ -58,15 +58,16 @@ in ./hydrogen/nixos/programs.nix ./hydrogen/nixos/connectivity.nix - # QUIRK: - # Had issue when building the installer as it fails to bootstrap itself - # Might be useful to disable for the first build. - ../nixosModules/extra/secure_dns.nix + ../nixosModules/common/fish.nix ../nixosModules/common/disable-command-not-found.nix ../nixosModules/common/network.nix ../nixosModules/common/sudo-conf.nix ../nixosModules/common/system-nixconf.nix + # QUIRK: + # Had issue when building the installer as it fails to bootstrap itself + # Might be useful to disable for the first build. + ../nixosModules/extra/secure_dns.nix ../nixosModules/extra/leana.nix # diff --git a/nix/configurations/vanadium.nix b/nix/configurations/vanadium.nix index 0e72a47e..9d3f7cbc 100644 --- a/nix/configurations/vanadium.nix +++ b/nix/configurations/vanadium.nix @@ -101,6 +101,7 @@ in ./vanadium/nixos/unfree-predicate.nix ./vanadium/nixos/programs.nix + ../nixosModules/common/fish.nix ../nixosModules/common/disable-command-not-found.nix ../nixosModules/common/network.nix ../nixosModules/common/sudo-conf.nix diff --git a/nix/nixosModules/common/fish.nix b/nix/nixosModules/common/fish.nix new file mode 100644 index 00000000..af742154 --- /dev/null +++ b/nix/nixosModules/common/fish.nix @@ -0,0 +1,22 @@ +# +# This module links fish vendor completions, otherwise tab completion would be broken. +# +{ + config, + lib, + ... +}: let + fishNixOSEnabled = config.programs.fish.enable; + fishHMEnabled = + if config ? home-manager + then lib.any (userConfig: userConfig.programs.fish.enable) (lib.attrValues config.home-manager.users) + else false; + + fishEnabled = fishNixOSEnabled || fishHMEnabled; +in { + environment.pathsToLink = lib.mkIf fishEnabled [ + "/share/fish/vendor_conf.d" + "/share/fish/vendor_completions.d" + "/share/fish/vendor_functions.d" + ]; +} diff --git a/nix/nixosModules/extra/leana.nix b/nix/nixosModules/extra/leana.nix index 0f884580..d61e958b 100644 --- a/nix/nixosModules/extra/leana.nix +++ b/nix/nixosModules/extra/leana.nix @@ -18,12 +18,6 @@ }; users.groups.leana = {}; - environment.pathsToLink = [ - "/share/fish/vendor_conf.d" - "/share/fish/vendor_completions.d" - "/share/fish/vendor_functions.d" - ]; - # # My nix binary cache #