From a5c6d7e075affe0ca95bd8e64fce9c387efc382b Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 9 Feb 2024 16:20:57 -0500 Subject: seth: modularize user setup --- modules/nixos/traits/users.nix | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'modules/nixos/traits') diff --git a/modules/nixos/traits/users.nix b/modules/nixos/traits/users.nix index 3d50ce7..31d1b9c 100644 --- a/modules/nixos/traits/users.nix +++ b/modules/nixos/traits/users.nix @@ -8,10 +8,6 @@ cfg = config.traits.users; inherit (config.networking) hostName; in { - imports = [ - ../../../users/seth/nixos.nix - ]; - options.traits.users = { hostUser = { enable = lib.mkEnableOption "${hostName} user configuration"; @@ -21,6 +17,14 @@ in { default = config.traits.secrets.enable; }; }; + + seth = { + manageSecrets = + lib.mkEnableOption "automatic secrets management" + // { + default = config.traits.secrets.enable; + }; + }; }; config = lib.mkMerge [ @@ -40,5 +44,15 @@ in { hashedPasswordFile = config.age.secrets.userPassword.path; }; }) + + (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