summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/per-user.nix
blob: 9080e3b44ce4c85f95a7633495e6708f65d3ee8a (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
with import <stockholm/lib>;
{ config, pkgs, ... }: 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 = {
    environment = {
      etc = flip mapAttrs' cfg (name: { packages, ... }: {
        name = "per-user/${name}";
        value.source = pkgs.buildEnv {
          name = "per-user.${name}";
          paths = packages;
          pathsToLink = [
            "/bin"
          ];
        };
      });
      profiles = ["/etc/per-user/$LOGNAME"];
    };
  };
}