summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-02-24 11:57:03 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-02-24 11:57:38 +0100
commit16cf3ee9da57738899859a9031ba276061a7999f (patch)
tree806531a433fcde5167d2d1ddfc505badf8426d04 /nixos/modules/config
parent31e4ce5e03f33cc93cf2048a9653162493b9f9c3 (diff)
downloadnixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar
nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.gz
nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.bz2
nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.lz
nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.xz
nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.zst
nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.zip
Ensure that the home directory exists even if the user already exists
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/update-users-groups.pl10
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
index d35ecb754bd..de73de91629 100644
--- a/nixos/modules/config/update-users-groups.pl
+++ b/nixos/modules/config/update-users-groups.pl
@@ -174,12 +174,12 @@ foreach my $u (@{$spec->{users}}) {
         } 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};
-            chown $u->{uid}, $u->{gid}, $u->{home};
-        }
+    # Create a home directory.
+    if ($u->{createHome} && ! -e $u->{home}) {
+        make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home};
+        chown $u->{uid}, $u->{gid}, $u->{home};
     }
 
     if (defined $u->{passwordFile}) {