summaryrefslogtreecommitdiff
path: root/modules/nixos
diff options
context:
space:
mode:
authorseth <[email protected]>2024-02-09 16:20:57 -0500
committerseth <[email protected]>2024-02-09 16:20:57 -0500
commita5c6d7e075affe0ca95bd8e64fce9c387efc382b (patch)
tree090db4dd6c07906d46013432dca668bccb2e3ad0 /modules/nixos
parented19b2e58435bb6db6a10758b025821256b1af1f (diff)
seth: modularize user setup
Diffstat (limited to 'modules/nixos')
-rw-r--r--modules/nixos/traits/users.nix22
1 files changed, 18 insertions, 4 deletions
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;
+ };
+ })
];
}