summary refs log tree commit diff
path: root/nixos/modules/config/update-users-groups.pl
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-03 11:59:38 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-11-03 12:32:19 +0100
commit1b53a3fcb7d6f1f31c4178131d8dff2177c81060 (patch)
tree8bcdf7e26c74808ea6a58786cce787dc2c1936df /nixos/modules/config/update-users-groups.pl
parentcb981b9dad4bd0e64a01b1abc14d2008151a2aa7 (diff)
downloadnixlib-1b53a3fcb7d6f1f31c4178131d8dff2177c81060.tar
nixlib-1b53a3fcb7d6f1f31c4178131d8dff2177c81060.tar.gz
nixlib-1b53a3fcb7d6f1f31c4178131d8dff2177c81060.tar.bz2
nixlib-1b53a3fcb7d6f1f31c4178131d8dff2177c81060.tar.lz
nixlib-1b53a3fcb7d6f1f31c4178131d8dff2177c81060.tar.xz
nixlib-1b53a3fcb7d6f1f31c4178131d8dff2177c81060.tar.zst
nixlib-1b53a3fcb7d6f1f31c4178131d8dff2177c81060.zip
Add initialPassword and initialHashedPassword options
These are like password and hashedPassword, except that they only
apply when the user is initially created.
Diffstat (limited to 'nixos/modules/config/update-users-groups.pl')
-rw-r--r--nixos/modules/config/update-users-groups.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
index abcb082af8e5..9f91dbe1b569 100644
--- a/nixos/modules/config/update-users-groups.pl
+++ b/nixos/modules/config/update-users-groups.pl
@@ -169,6 +169,12 @@ foreach my $u (@{$spec->{users}}) {
     } else {
         $u->{uid} = allocUid($u->{isSystemUser}) if !defined $u->{uid};
 
+        if (defined $u->{initialPassword}) {
+            $u->{hashedPassword} = hashPassword($u->{initialPassword});
+        } elsif (defined $u->{initialHashedPassword}) {
+            $u->{hashedPassword} = $u->{initialHashedPassword};
+        }
+
         # Create a home directory.
         if ($u->{createHome}) {
             make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home};