blob: f83a29acb9d564f02f55a70c8ef051893ea61bcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
{ config, pkgs, lib, ... }:
with lib; let
cfg = config.krebs.per-user;
in {
options.krebs.per-user = mkOption {
type = types.attrsOf (types.submodule {
options = {
packages = mkOption {
type = types.listOf types.path;
default = [];
};
};
});
default = {};
};
config = mkIf (cfg != {}) {
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);
# XXX this breaks /etc/pam/environment because $LOGNAME doesn't get
# replaced by @{PAM_USER} the way $USER does.
# See <nixpkgs/nixos/modules/config/system-environment.nix>
#profiles = ["/etc/per-user/$LOGNAME"];
profiles = ["/etc/per-user/$USER"];
};
};
}
|