0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixos/user-groups: add a toggle for user account creation

Microscopic change that allows users to toggle user accounts, per user, conditionally.
This commit is contained in:
NotAShelf 2024-11-24 11:28:32 +03:00
parent 0cc23d26e1
commit 1dd23b5d74
No known key found for this signature in database
GPG key ID: EED98D11B85A2819
2 changed files with 14 additions and 1 deletions

View file

@ -124,6 +124,16 @@ let
options = {
enable = mkOption {
type = types.bool;
default = true;
example = false;
description = ''
If set to false, the user account will not be created. This is useful for when you wish to conditionally
disable user accounts.
'';
};
name = mkOption {
type = types.passwdEntry types.str;
apply = x: assert (stringLength x < 32 || abort "Username '${x}' is longer than 31 characters which is not allowed!"); x;
@ -557,7 +567,7 @@ let
autoSubUidGidRange subUidRanges subGidRanges
initialPassword initialHashedPassword expires;
shell = utils.toShellPath u.shell;
}) cfg.users;
}) (filterAttrs (_: u: u.enable) cfg.users);
groups = attrValues cfg.groups;
});