nixos/users-group: make homeMode respect is_dry and create home directly with right permissions

This commit is contained in:
Federico Beffa 2022-05-21 14:18:10 +02:00
parent 311aa6d05d
commit 572ff94f55

View File

@ -223,8 +223,8 @@ foreach my $u (@{$spec->{users}}) {
}
# Ensure home directory incl. ownership and permissions.
if ($u->{createHome}) {
make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home} and ! $is_dry;
if ($u->{createHome} and !$is_dry) {
make_path($u->{home}, { mode => oct($u->{homeMode}) }) if ! -e $u->{home};
chown $u->{uid}, $u->{gid}, $u->{home};
chmod oct($u->{homeMode}), $u->{home};
}