summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/per-user.nix
blob: 9cbd9e1ea6c846c3494dd0b1275073047efe87af (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
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.symlinkJoin {
          name = "per-user.${name}";
          paths = packages;
        };
      });
      profiles = ["/etc/per-user/$LOGNAME"];
    };
  };
}