blob: 3d50ce753d025da057cd7119b0e483c610ceb331 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
{
config,
lib,
pkgs,
secretsDir,
...
}: let
cfg = config.traits.users;
inherit (config.networking) hostName;
in {
imports = [
../../../users/seth/nixos.nix
];
options.traits.users = {
hostUser = {
enable = lib.mkEnableOption "${hostName} user configuration";
manageSecrets =
lib.mkEnableOption "automatic secrets management"
// {
default = config.traits.secrets.enable;
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.hostUser.enable {
users.users.${hostName} = {
isNormalUser = true;
shell = pkgs.bash;
};
})
(lib.mkIf (cfg.hostUser.enable && cfg.hostUser.manageSecrets) {
age.secrets = {
userPassword.file = secretsDir + "/userPassword.age";
};
users.users.${hostName} = {
hashedPasswordFile = config.age.secrets.userPassword.path;
};
})
];
}
|