modules/user: add extraGroups setting with default

This commit is contained in:
Johannes Kirschbauer
2025-07-11 09:13:59 +02:00
committed by a-kenji
parent 02d35395a8
commit 6019efe40a

View File

@@ -22,6 +22,32 @@
example = false; example = false;
description = "Whether the user should be prompted."; description = "Whether the user should be prompted.";
}; };
extraGroups = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"wheel"
"networkmanager"
"video"
"input"
];
example = [
"wheel"
"networkmanager"
];
description = ''
Additional groups the user should be added to.
Defaults to: [ "wheel" "networkmanager" "video" "input" ].
Attention: Setting this option will clear the default groups!
Explanation of the default groups:
- "wheel" - Allows the user to run commands as root using `sudo`.
- "networkmanager" - Allows the user to manage network connections.
- "video" - Allows the user to access video devices.
- "input" - Allows the user to access input devices.
'';
};
}; };
}; };
@@ -40,6 +66,10 @@
users.users.${settings.user}.hashedPasswordFile = users.users.${settings.user}.hashedPasswordFile =
config.clan.core.vars.generators."user-password-${settings.user}".files.user-password-hash.path; config.clan.core.vars.generators."user-password-${settings.user}".files.user-password-hash.path;
users.users.${settings.user} = {
extraGroups = settings.extraGroups;
};
clan.core.vars.generators."user-password-${settings.user}" = { clan.core.vars.generators."user-password-${settings.user}" = {
files.user-password-hash.neededFor = "users"; files.user-password-hash.neededFor = "users";