2016-10-20 18:54:38 +00:00
|
|
|
with import <stockholm/lib>;
|
2017-11-12 08:43:25 +00:00
|
|
|
{ config, pkgs, ... }: let
|
2015-11-06 20:37:58 +00:00
|
|
|
cfg = config.krebs.per-user;
|
2017-11-12 08:43:25 +00:00
|
|
|
in {
|
|
|
|
options.krebs.per-user = mkOption {
|
|
|
|
type = types.attrsOf (types.submodule {
|
2015-11-06 20:29:49 +00:00
|
|
|
options = {
|
|
|
|
packages = mkOption {
|
2017-11-12 08:43:25 +00:00
|
|
|
type = types.listOf types.path;
|
2015-11-06 20:29:49 +00:00
|
|
|
default = [];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = {};
|
|
|
|
};
|
2019-01-05 19:16:17 +00:00
|
|
|
config = mkIf (cfg != {}) {
|
2015-11-06 20:29:49 +00:00
|
|
|
environment = {
|
2017-11-12 09:47:36 +00:00
|
|
|
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"];
|
|
|
|
};
|
|
|
|
};
|
2017-11-12 08:43:25 +00:00
|
|
|
}
|