From 34a7a042a36b63eb6b900932b1e420e4b6014a57 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 5 May 2024 11:35:18 -0400 Subject: simplify some things (#353) * flake: drop flake-parts * flake: add back flake-parts * flake: use flake module again for configurations --- modules/nixos/traits/users.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 modules/nixos/traits/users.nix (limited to 'modules/nixos/traits/users.nix') diff --git a/modules/nixos/traits/users.nix b/modules/nixos/traits/users.nix new file mode 100644 index 0000000..2802901 --- /dev/null +++ b/modules/nixos/traits/users.nix @@ -0,0 +1,30 @@ +{ + config, + lib, + secretsDir, + ... +}: let + cfg = config.traits.users; +in { + options.traits.users = { + seth = { + manageSecrets = + lib.mkEnableOption "automatic secrets management" + // { + default = config.traits.secrets.enable; + }; + }; + }; + + config = lib.mkMerge [ + (lib.mkIf (cfg.seth.enable && cfg.seth.manageSecrets) { + age.secrets = { + sethPassword.file = secretsDir + "/sethPassword.age"; + }; + + users.users.seth = { + hashedPasswordFile = lib.mkDefault config.age.secrets.sethPassword.path; + }; + }) + ]; +} -- cgit v1.2.3