per-user module: create profiles only when needed

Refs https://github.com/NixOS/nixpkgs/pull/25712
This commit is contained in:
tv 2017-11-12 10:47:36 +01:00
parent 9c8680981f
commit 7393d245d6

View File

@ -15,16 +15,19 @@ in {
}; };
config = { config = {
environment = { environment = {
etc = flip mapAttrs' cfg (name: { packages, ... }: { etc =
name = "per-user/${name}"; mapAttrs'
value.source = pkgs.buildEnv { (name: per-user: {
name = "per-user.${name}"; name = "per-user/${name}";
paths = packages; value.source = pkgs.buildEnv {
pathsToLink = [ name = "per-user.${name}";
"/bin" paths = per-user.packages;
]; pathsToLink = [
}; "/bin"
}); ];
};
})
(filterAttrs (_: per-user: per-user.packages != []) cfg);
profiles = ["/etc/per-user/$LOGNAME"]; profiles = ["/etc/per-user/$LOGNAME"];
}; };
}; };