···167168 # We know that the `user` attribute exists because we set a default value
169 # for it above, allowing us to use it without worries here
170- users.users.${cfg.settings.user} = {};
171172 # ...
173 };
···167168 # We know that the `user` attribute exists because we set a default value
169 # for it above, allowing us to use it without worries here
170+ users.users.${cfg.settings.user} = { isSystemUser = true; };
171172 # ...
173 };
+7
nixos/doc/manual/release-notes/rl-2105.xml
···846 </para>
847 </listitem>
848 <listitem>
0000000849 <para>
850 The GNOME desktop manager once again installs <package>gnome3.epiphany</package> by default.
851 </para>
···846 </para>
847 </listitem>
848 <listitem>
849+ <para>
850+ When defining a new user, one of <xref linkend="opt-users.users._name_.isNormalUser" /> and <xref linkend="opt-users.users._name_.isSystemUser" /> is now required.
851+ This is to prevent accidentally giving a UID above 1000 to system users, which could have unexpected consequences, like running user activation scripts for system users.
852+ Note that users defined with an explicit UID below 500 are exempted from this check, as <xref linkend="opt-users.users._name_.isSystemUser" /> has no effect for those.
853+ </para>
854+ </listitem>
855+ <listitem>
856 <para>
857 The GNOME desktop manager once again installs <package>gnome3.epiphany</package> by default.
858 </para>
+1
nixos/modules/config/pulseaudio.nix
···306 description = "PulseAudio system service user";
307 home = stateDir;
308 createHome = true;
0309 };
310311 users.groups.pulse.gid = gid;
···306 description = "PulseAudio system service user";
307 home = stateDir;
308 createHome = true;
309+ isSystemUser = true;
310 };
311312 users.groups.pulse.gid = gid;
+25-9
nixos/modules/config/users-groups.nix
···92 the user's UID is allocated in the range for system users
93 (below 500) or in the range for normal users (starting at
94 1000).
0095 '';
96 };
97···107 <option>useDefaultShell</option> to <literal>true</literal>,
108 and <option>isSystemUser</option> to
109 <literal>false</literal>.
00110 '';
111 };
112···521 };
522 nobody = {
523 uid = ids.uids.nobody;
0524 description = "Unprivileged account (don't use!)";
525 group = "nogroup";
526 };
···608 Neither the root account nor any wheel user has a password or SSH authorized key.
609 You must set one to prevent being locked out of your system.'';
610 }
611- ] ++ flip mapAttrsToList cfg.users (name: user:
612- {
0613 assertion = (user.hashedPassword != null)
614- -> (builtins.match ".*:.*" user.hashedPassword == null);
615 message = ''
616- The password hash of user "${user.name}" contains a ":" character.
617- This is invalid and would break the login system because the fields
618- of /etc/shadow (file where hashes are stored) are colon-separated.
619- Please check the value of option `users.users."${user.name}".hashedPassword`.'';
620- }
621- );
0000000000622623 warnings =
624 builtins.filter (x: x != null) (
···92 the user's UID is allocated in the range for system users
93 (below 500) or in the range for normal users (starting at
94 1000).
95+ Exactly one of <literal>isNormalUser</literal> and
96+ <literal>isSystemUser</literal> must be true.
97 '';
98 };
99···109 <option>useDefaultShell</option> to <literal>true</literal>,
110 and <option>isSystemUser</option> to
111 <literal>false</literal>.
112+ Exactly one of <literal>isNormalUser</literal> and
113+ <literal>isSystemUser</literal> must be true.
114 '';
115 };
116···525 };
526 nobody = {
527 uid = ids.uids.nobody;
528+ isSystemUser = true;
529 description = "Unprivileged account (don't use!)";
530 group = "nogroup";
531 };
···613 Neither the root account nor any wheel user has a password or SSH authorized key.
614 You must set one to prevent being locked out of your system.'';
615 }
616+ ] ++ flatten (flip mapAttrsToList cfg.users (name: user:
617+ [
618+ {
619 assertion = (user.hashedPassword != null)
620+ -> (builtins.match ".*:.*" user.hashedPassword == null);
621 message = ''
622+ The password hash of user "${user.name}" contains a ":" character.
623+ This is invalid and would break the login system because the fields
624+ of /etc/shadow (file where hashes are stored) are colon-separated.
625+ Please check the value of option `users.users."${user.name}".hashedPassword`.'';
626+ }
627+ {
628+ assertion = let
629+ xor = a: b: a && !b || b && !a;
630+ isEffectivelySystemUser = user.isSystemUser || (user.uid != null && user.uid < 500);
631+ in xor isEffectivelySystemUser user.isNormalUser;
632+ message = ''
633+ Exactly one of users.users.${user.name}.isSystemUser and users.users.${user.name}.isNormalUser must be set.
634+ '';
635+ }
636+ ]
637+ ));
638639 warnings =
640 builtins.filter (x: x != null) (
···132133 users.users = {
134 # user that is permitted to access the unix socket
135- someuser.extraGroups = [
136- config.users.users.unbound.group
137- ];
000138139 # user that is not permitted to access the unix socket
140- unauthorizeduser = {};
141 };
142143 environment.etc = {
···132133 users.users = {
134 # user that is permitted to access the unix socket
135+ someuser = {
136+ isSystemUser = true;
137+ extraGroups = [
138+ config.users.users.unbound.group
139+ ];
140+ };
141142 # user that is not permitted to access the unix socket
143+ unauthorizeduser = { isSystemUser = true; };
144 };
145146 environment.etc = {
+5-5
pkgs/applications/editors/vscode/vscode.nix
···13 archive_fmt = if system == "x86_64-darwin" then "zip" else "tar.gz";
1415 sha256 = {
16- x86_64-linux = "0z1diiiykv4ilsiljffz9sl2mlvrxq0xwm8ga2ralfvjwbhzr6dn";
17- x86_64-darwin = "02gzw46w3kzw1ya9nx8fkhvzi0mbpz2fyp47n58jki2zkdsfiwzh";
18- aarch64-linux = "0bkvgdxch95dqcb41ncsjkaaswmwv6zad4hzdsr3famjm2vym1ky";
19- armv7l-linux = "0wdp97ihdnx9bcyn2dh6wzhb7qvdj6x730r7ng1q3i9jhd19wfi3";
20 }.${system};
21in
22 callPackage ./generic.nix rec {
···2526 # Please backport all compatible updates to the stable release.
27 # This is important for the extension ecosystem.
28- version = "1.55.0";
29 pname = "vscode";
3031 executableName = "code" + lib.optionalString isInsiders "-insiders";
···13 archive_fmt = if system == "x86_64-darwin" then "zip" else "tar.gz";
1415 sha256 = {
16+ x86_64-linux = "08151qdhf4chg9gfbs0dl0v0k5vla2gz5dfy439jzdg1d022d5rw";
17+ x86_64-darwin = "1vlxxkv3wvds3xl3ir93l5q5yq2d7mcragsicfayj9x9r49ilqn3";
18+ aarch64-linux = "0rxw1wsi555z41ak817sxqyyan0rm7hma640zsh8dz0yvhzdv1h8";
19+ armv7l-linux = "1ijvd7r2fxxlw4zv3zx5h70b3d0b4gcq3aljsi02v1lr2zm8f8gb";
20 }.${system};
21in
22 callPackage ./generic.nix rec {
···2526 # Please backport all compatible updates to the stable release.
27 # This is important for the extension ecosystem.
28+ version = "1.55.2";
29 pname = "vscode";
3031 executableName = "code" + lib.optionalString isInsiders "-insiders";