diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/darwin/traits/users.nix | 14 | ||||
| -rw-r--r-- | modules/flake/configurations.nix | 2 | ||||
| -rw-r--r-- | modules/nixos/traits/users.nix | 22 | ||||
| -rw-r--r-- | modules/shared/traits/default.nix | 1 | ||||
| -rw-r--r-- | modules/shared/traits/users.nix | 40 |
5 files changed, 72 insertions, 7 deletions
diff --git a/modules/darwin/traits/users.nix b/modules/darwin/traits/users.nix index b0a2078..7ad7491 100644 --- a/modules/darwin/traits/users.nix +++ b/modules/darwin/traits/users.nix @@ -1,5 +1,15 @@ { - imports = [ - ../../../users/seth/darwin.nix + config, + lib, + ... +}: let + cfg = config.traits.users; +in { + config = lib.mkMerge [ + (lib.mkIf cfg.seth.enable { + home-manager.users.seth = { + seth.desktop.enable = false; + }; + }) ]; } diff --git a/modules/flake/configurations.nix b/modules/flake/configurations.nix index 6cbe2cb..c7bff5b 100644 --- a/modules/flake/configurations.nix +++ b/modules/flake/configurations.nix @@ -68,7 +68,7 @@ modules = [ - ../../users/${name}/home.nix + ../../users/${name} { _module.args.osConfig = {}; 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; + }; + }) ]; } diff --git a/modules/shared/traits/default.nix b/modules/shared/traits/default.nix index fa5ba25..7f5a47d 100644 --- a/modules/shared/traits/default.nix +++ b/modules/shared/traits/default.nix @@ -2,5 +2,6 @@ imports = [ ./locale.nix ./home-manager.nix + ./users.nix ]; } diff --git a/modules/shared/traits/users.nix b/modules/shared/traits/users.nix new file mode 100644 index 0000000..c7b713a --- /dev/null +++ b/modules/shared/traits/users.nix @@ -0,0 +1,40 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: let + cfg = config.traits.users; +in { + options.traits.users = { + seth = { + enable = lib.mkEnableOption "Seth's user & home configurations"; + }; + }; + + config = lib.mkMerge [ + (lib.mkIf cfg.seth.enable { + users.users.seth = + { + shell = pkgs.fish; + home = lib.mkDefault ( + if pkgs.stdenv.isDarwin + then "/Users/seth" + else "/home/seth" + ); + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + extraGroups = ["wheel"]; + isNormalUser = true; + }; + + programs.fish.enable = lib.mkDefault true; + + home-manager.users.seth = { + imports = [inputs.self.homeModules.seth]; + seth.enable = true; + }; + }) + ]; +} |
