Author: eelco
Date: Mon Jun 27 08:50:30 2011
New Revision: 27545
URL: https://svn.nixos.org/websvn/nix/?rev=27545&sc=1

Log:
* Support creating non-system user accounts.

Modified:
   nixos/trunk/modules/config/users-groups.nix

Modified: nixos/trunk/modules/config/users-groups.nix
==============================================================================
--- nixos/trunk/modules/config/users-groups.nix Mon Jun 27 08:04:54 2011        
(r27544)
+++ nixos/trunk/modules/config/users-groups.nix Mon Jun 27 08:50:30 2011        
(r27545)
@@ -24,6 +24,7 @@
           }
         ];
 
+      # !!! Use NixOS module system to add default attributes.
       addAttrs =
         { name
         , description
@@ -35,8 +36,9 @@
         , 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 @@
 
   # 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 @@
             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" \
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to