0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00: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

@ -462,8 +462,11 @@
- `gerbera` now has wavpack support.
- A toggle has been added under `users.users.<name>.enable` to allow toggling individual users conditionally. If set to false, the user account will not be created.
- `ddclient` was updated from 3.11.2 to 4.0.0 [Release notes](https://github.com/ddclient/ddclient/releases/tag/v4.0.0)
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
```{=include=} sections

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;
});