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

35 lines
837 B
Nix
Raw Normal View History

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