From 899dfb9f21954877d4d19205de18211c437b14ee Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 23 Apr 2025 19:38:55 +0100 Subject: [PATCH] Extract a pass module --- hosts/PW05CH3L/configuration.nix | 1 + hosts/common/default.nix | 10 ---------- hosts/t480/configuration.nix | 2 ++ modules/nixos/cli/default.nix | 1 + modules/nixos/cli/password-store.nix | 30 ++++++++++++++++++++++++++++ 5 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 modules/nixos/cli/password-store.nix diff --git a/hosts/PW05CH3L/configuration.nix b/hosts/PW05CH3L/configuration.nix index 34f97dac..b70e391f 100644 --- a/hosts/PW05CH3L/configuration.nix +++ b/hosts/PW05CH3L/configuration.nix @@ -10,6 +10,7 @@ nixosModules = { cli = { docker.enable = true; + password-store.enable = true; }; }; diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 196f05ec..36a5f420 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -43,16 +43,6 @@ fastfetch mermaid-cli mkcert - passmenu-otp - - (pass.withExtensions ( - e: with e; [ - passExtensions.pass-audit - passExtensions.pass-import - passExtensions.pass-otp - passExtensions.pass-update - ] - )) ]; home-manager = { diff --git a/hosts/t480/configuration.nix b/hosts/t480/configuration.nix index 2d2442cf..bfb0fc56 100644 --- a/hosts/t480/configuration.nix +++ b/hosts/t480/configuration.nix @@ -13,6 +13,8 @@ ]; nixosModules = { + cli.password-store.enable = true; + core = { bluetooth.enable = true; openssh.enable = true; diff --git a/modules/nixos/cli/default.nix b/modules/nixos/cli/default.nix index f768e96d..5e7e09fc 100644 --- a/modules/nixos/cli/default.nix +++ b/modules/nixos/cli/default.nix @@ -2,5 +2,6 @@ imports = [ ./docker.nix ./podman.nix + ./password-store.nix ]; } diff --git a/modules/nixos/cli/password-store.nix b/modules/nixos/cli/password-store.nix new file mode 100644 index 00000000..190e56c9 --- /dev/null +++ b/modules/nixos/cli/password-store.nix @@ -0,0 +1,30 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; + +let + cfg = config.nixosModules.cli.password-store; +in +{ + options.nixosModules.cli.password-store.enable = mkEnableOption "Enable pass"; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + passmenu-otp + + (pass.withExtensions ( + e: with e; [ + passExtensions.pass-audit + passExtensions.pass-import + passExtensions.pass-otp + passExtensions.pass-update + ] + )) + ]; + }; +}