From 010a2a755542681c9e18dd90c0b417807b4c5759 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Jun 2011 08:50:30 +0000 Subject: [PATCH] * Support creating non-system user accounts. svn path=/nixos/trunk/; revision=27545 --- modules/config/users-groups.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/config/users-groups.nix b/modules/config/users-groups.nix index 6d57209a4ac..a0210630b0f 100644 --- a/modules/config/users-groups.nix +++ b/modules/config/users-groups.nix @@ -24,6 +24,7 @@ let } ]; + # !!! Use NixOS module system to add default attributes. addAttrs = { name , description @@ -35,8 +36,9 @@ let , createHome ? false , useDefaultShell ? false , password ? null + , isSystemUser ? true }: - { inherit name description uid group extraGroups home shell createHome password; }; + { inherit name description uid group extraGroups home shell createHome password isSystemUser; }; in map addAttrs (defaultUsers ++ config.users.extraUsers); @@ -104,7 +106,7 @@ let # Note: the 'X' in front of the password is to distinguish between # having an empty password, and not having a password. - serializedUser = u: "${u.name}\n${u.description}\n${toString u.uid}\n${u.group}\n${toString (concatStringsSep "," u.extraGroups)}\n${u.home}\n${u.shell}\n${toString u.createHome}\n${if u.password != null then "X" + u.password else ""}\n"; + serializedUser = u: "${u.name}\n${u.description}\n${toString u.uid}\n${u.group}\n${toString (concatStringsSep "," u.extraGroups)}\n${u.home}\n${u.shell}\n${toString u.createHome}\n${if u.password != null then "X" + u.password else ""}\n${toString u.isSystemUser}\n"; serializedGroup = g: "${g.name}\n${toString g.gid}"; # keep this extra file so that cat can be used to pass special chars such as "`" which is used in the avahi daemon @@ -186,9 +188,10 @@ in read shell read createHome read password + read isSystemUser if ! curEnt=$(getent passwd "$name"); then - useradd --system \ + useradd ''${isSystemUser:+--system} \ --comment "$description" \ ''${uid:+--uid $uid} \ --gid "$group" \