Skip to content

Commit

Permalink
chown home dirs using names, not uids/gids.
Browse files Browse the repository at this point in the history
  • Loading branch information
falsifian committed Feb 10, 2014
1 parent dd673c3 commit 0a80898
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nixos/modules/config/users-groups.nix
Expand Up @@ -429,13 +429,13 @@ in
'';
mkhome = n: u:
let
uid = toString u.uid;
gid = toString ((getGroup u.group).gid);
uname = toString u.name;
gname = toString ((getGroup u.group).name);
h = u.home;
in ''
test -a "${h}" || mkdir -p "${h}" || true
test "$(stat -c %u "${h}")" = ${uid} || chown ${uid} "${h}" || true
test "$(stat -c %g "${h}")" = ${gid} || chgrp ${gid} "${h}" || true
test "$(stat -c %U "${h}")" = ${uname} || chown ${uname} "${h}" || true
test "$(stat -c %G "${h}")" = ${gname} || chgrp ${gname} "${h}" || true
'';
in stringAfter [ "etc" ] ''
touch /etc/group
Expand Down

0 comments on commit 0a80898

Please sign in to comment.