1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

users.users: only extend profiles if packages are defined

This commit is contained in:
Daiderd Jordan 2019-02-23 11:43:39 +01:00
parent ece03c592e
commit 6c6c8f2164
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 9 additions and 4 deletions

View file

@ -17,6 +17,8 @@ let
createdUsers = mapAttrsToList (n: v: v) (filterAttrs (n: v: isCreated cfg.knownUsers v.name) cfg.users); createdUsers = mapAttrsToList (n: v: v) (filterAttrs (n: v: isCreated cfg.knownUsers v.name) cfg.users);
deletedGroups = filter (n: isDeleted cfg.groups n) cfg.knownGroups; deletedGroups = filter (n: isDeleted cfg.groups n) cfg.knownGroups;
deletedUsers = filter (n: isDeleted cfg.users n) cfg.knownUsers; deletedUsers = filter (n: isDeleted cfg.users n) cfg.knownUsers;
packageUsers = filterAttrs (_: u: u.packages != []) cfg.users;
in in
{ {
@ -166,8 +168,8 @@ in
inherit (config.environment) pathsToLink extraOutputsToInstall; inherit (config.environment) pathsToLink extraOutputsToInstall;
inherit (config.system.path) postBuild; inherit (config.system.path) postBuild;
}; };
}) (filterAttrs (_: u: u.packages != []) cfg.users); }) packageUsers;
environment.profiles = mkOrder 900 [ "/etc/profiles/per-user/$USER" ]; environment.profiles = mkIf (packageUsers != {}) (mkOrder 900 [ "/etc/profiles/per-user/$USER" ]);
}; };
} }

View file

@ -4,10 +4,10 @@ with lib;
{ {
test = '' test = ''
echo checking /run/current-system/sw/bin in setEnvironment >&2 echo checking /run/current-system/sw/bin in environment >&2
grep 'export PATH=.*:/run/current-system/sw/bin' ${config.system.build.setEnvironment} grep 'export PATH=.*:/run/current-system/sw/bin' ${config.system.build.setEnvironment}
echo checking /bin and /sbin in setEnvironment >&2 echo checking /bin and /sbin in environment >&2
grep 'export PATH=.*:/usr/bin:/usr/sbin:/bin:/sbin' ${config.system.build.setEnvironment} grep 'export PATH=.*:/usr/bin:/usr/sbin:/bin:/sbin' ${config.system.build.setEnvironment}
''; '';
} }

View file

@ -24,5 +24,8 @@ in
echo checking for unexpected paths in /etc/profiles/per-user/foo/bin >&2 echo checking for unexpected paths in /etc/profiles/per-user/foo/bin >&2
test -e ${config.out}/etc/profiles/per-user/foo/lib/libhello.dylib && return test -e ${config.out}/etc/profiles/per-user/foo/lib/libhello.dylib && return
echo "checking /etc/profiles/per-user/foo/bin in environment" >&2
grep 'export PATH=.*:/etc/profiles/per-user/$USER/bin' ${config.system.build.setEnvironment}
''; '';
} }