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 = {
environment = {
etc = flip mapAttrs' cfg (name: { packages, ... }: {
name = "per-user/${name}";
value.source = pkgs.buildEnv {
name = "per-user.${name}";
paths = packages;
pathsToLink = [
"/bin"
];
};
});
etc =
mapAttrs'
(name: per-user: {
name = "per-user/${name}";
value.source = pkgs.buildEnv {
name = "per-user.${name}";
paths = per-user.packages;
pathsToLink = [
"/bin"
];
};
})
(filterAttrs (_: per-user: per-user.packages != []) cfg);
profiles = ["/etc/per-user/$LOGNAME"];
};
};