stockholm/krebs/3modules/per-user.nix

35 lines
837 B
Nix
Raw Normal View History

2016-10-20 20:54:38 +02:00
with import <stockholm/lib>;
{ config, pkgs, ... }: let
2015-11-06 21:37:58 +01:00
cfg = config.krebs.per-user;
in {
options.krebs.per-user = mkOption {
type = types.attrsOf (types.submodule {
2015-11-06 21:29:49 +01:00
options = {
packages = mkOption {
type = types.listOf types.path;
2015-11-06 21:29:49 +01:00
default = [];
};
};
});
default = {};
};
config = mkIf (cfg != {}) {
2015-11-06 21:29:49 +01:00
environment = {
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);
2015-11-06 21:29:49 +01:00
profiles = ["/etc/per-user/$LOGNAME"];
};
};
}