summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien@users.noreply.github.com>2021-09-13 18:29:21 +0000
committerGitHub <noreply@github.com>2021-09-13 18:29:21 +0000
commit359203459580a280ae4962d7f7cece321525b872 (patch)
tree5e280c2af8a02a984cc0fa03d3caa87efacc513f /nixos/modules/config
parentdddf775e4c938b8ae4b0ecfae6ee3d37a850b19e (diff)
parent27f0f8965b91cf8b462fd0ff5a15cbe27746c4c5 (diff)
downloadnixpkgs-359203459580a280ae4962d7f7cece321525b872.tar
nixpkgs-359203459580a280ae4962d7f7cece321525b872.tar.gz
nixpkgs-359203459580a280ae4962d7f7cece321525b872.tar.bz2
nixpkgs-359203459580a280ae4962d7f7cece321525b872.tar.lz
nixpkgs-359203459580a280ae4962d7f7cece321525b872.tar.xz
nixpkgs-359203459580a280ae4962d7f7cece321525b872.tar.zst
nixpkgs-359203459580a280ae4962d7f7cece321525b872.zip
Merge pull request #133166 from symphorien/nonogroup
Don't default to nogroup for the primary group of users.
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/users-groups.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index d88162558e6..8e2db9107a1 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -123,7 +123,7 @@ let
       group = mkOption {
         type = types.str;
         apply = x: assert (builtins.stringLength x < 32 || abort "Group name '${x}' is longer than 31 characters which is not allowed!"); x;
-        default = "nogroup";
+        default = "";
         description = "The user's primary group.";
       };
 
@@ -640,6 +640,16 @@ in {
               Exactly one of users.users.${user.name}.isSystemUser and users.users.${user.name}.isNormalUser must be set.
             '';
           }
+          {
+            assertion = user.group != "";
+            message = ''
+              users.users.${user.name}.group is unset. This used to default to
+              nogroup, but this is unsafe. For example you can create a group
+              for this user with:
+              users.users.${user.name}.group = "${user.name}";
+              users.groups.${user.name} = {};
+            '';
+          }
         ]
     ));