2024-09-09 00:22:14 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-09-13 01:50:53 +00:00
|
|
|
with lib; let
|
2024-09-09 00:22:14 +00:00
|
|
|
cfg = config.custom.settings.users;
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
2024-09-09 00:22:14 +00:00
|
|
|
options.custom.settings.users = {
|
2024-09-13 01:50:53 +00:00
|
|
|
enable = mkOption {default = false;};
|
|
|
|
shell = mkOption {default = pkgs.fish;};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
${config.custom.username} = {
|
|
|
|
groups = mkOption {
|
|
|
|
default =
|
2024-09-13 01:50:53 +00:00
|
|
|
if config.custom.full
|
|
|
|
then [
|
|
|
|
"input"
|
|
|
|
"video"
|
|
|
|
]
|
|
|
|
else [];
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
2024-09-13 01:50:53 +00:00
|
|
|
linger = mkOption {default = false;};
|
|
|
|
packages = mkOption {default = [];};
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-09-13 01:50:53 +00:00
|
|
|
age.secrets = let
|
|
|
|
secret = filename: {
|
|
|
|
file = "${inputs.self}/secrets/${filename}";
|
2024-09-09 00:22:14 +00:00
|
|
|
};
|
2024-09-13 01:50:53 +00:00
|
|
|
in {
|
|
|
|
"${config.custom.profile}/users/${config.custom.username}.pass" = secret "${config.custom.profile}/users/${config.custom.username}.pass";
|
|
|
|
"${config.custom.profile}/users/root.pass" = secret "${config.custom.profile}/users/root.pass";
|
|
|
|
};
|
2024-09-09 00:22:14 +00:00
|
|
|
|
|
|
|
users = {
|
|
|
|
defaultUserShell = cfg.shell;
|
|
|
|
mutableUsers = false; # !! Immutable users
|
|
|
|
|
|
|
|
users = {
|
|
|
|
#!! secrets/PROFILE/users/USERNAME.pass hashedPasswordFile is required
|
|
|
|
|
|
|
|
root.hashedPasswordFile = config.age.secrets."${config.custom.profile}/users/root.pass".path;
|
|
|
|
|
|
|
|
${config.custom.username} = {
|
|
|
|
isNormalUser = true;
|
2024-09-13 01:50:53 +00:00
|
|
|
extraGroups = ["wheel"] ++ cfg.${config.custom.username}.groups;
|
2024-09-09 00:22:14 +00:00
|
|
|
hashedPasswordFile =
|
|
|
|
config.age.secrets."${config.custom.profile}/users/${config.custom.username}.pass".path;
|
|
|
|
linger = cfg.${config.custom.username}.linger;
|
|
|
|
packages = cfg.${config.custom.username}.packages;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|