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

35 lines
823 B
Nix
Raw Normal View History

2023-06-10 10:50:53 +00:00
{ config, pkgs, lib, ... }:
with lib; 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"];
};
};
}