···
map (range: "${user.name}:${toString range.startUid}:${toString range.count}\n")
-
subuidFile = concatStrings (map mkSubuidEntry (attrValues cfg.extraUsers));
mkSubgidEntry = user: concatStrings (
map (range: "${user.name}:${toString range.startGid}:${toString range.count}\n")
-
subgidFile = concatStrings (map mkSubgidEntry (attrValues cfg.extraUsers));
idsAreUnique = set: idAttr: !(fold (name: args@{ dup, acc }:
···
else { dup = false; acc = newAcc; }
) { dup = false; acc = {}; } (builtins.attrNames set)).dup;
-
uidsAreUnique = idsAreUnique (filterAttrs (n: u: u.uid != null) cfg.extraUsers) "uid";
-
gidsAreUnique = idsAreUnique (filterAttrs (n: g: g.gid != null) cfg.extraGroups) "gid";
spec = pkgs.writeText "users-groups.json" (builtins.toJSON {
inherit (cfg) mutableUsers;
···
name uid group description home shell createHome isSystemUser
password passwordFile hashedPassword
initialPassword initialHashedPassword;
groups = mapAttrsToList (n: g:
members = g.members ++ (mapAttrsToList (n: u: u.name) (
-
filterAttrs (n: u: elem g.name u.extraGroups) cfg.extraUsers
···
<literal>groupadd</literal> commands. On system activation, the
existing contents of the <literal>/etc/passwd</literal> and
<literal>/etc/group</literal> files will be merged with the
-
contents generated from the <literal>users.extraUsers</literal> and
-
<literal>users.extraGroups</literal> options.
The initial password for a user will be set
-
according to <literal>users.extraUsers</literal>, but existing passwords
···
group files will simply be replaced on system activation. This also
holds for the user passwords; all changed
passwords will be reset according to the
-
<literal>users.extraUsers</literal> configuration on activation.
···
-
users.extraUsers = mkOption {
type = types.loaOf types.optionSet;
···
-
users.extraGroups = mkOption {
···
description = "System administrator";
···
root.gid = ids.gids.root;
wheel.gid = ids.gids.wheel;
disk.gid = ids.gids.disk;
···
|| cfg.passwordFile != null
|| cfg.openssh.authorizedKeys.keys != []
|| cfg.openssh.authorizedKeys.keyFiles != [])
Neither the root account nor any wheel user has a password or SSH authorized key.
You must set one to prevent being locked out of your system.'';