stockholm/krebs/3modules/per-user.nix
2016-10-20 20:54:38 +02:00

39 lines
697 B
Nix

{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
let
cfg = config.krebs.per-user;
out = {
options.krebs.per-user = api;
config = imp;
};
api = mkOption {
type = with types; attrsOf (submodule {
options = {
packages = mkOption {
type = listOf path;
default = [];
};
};
});
default = {};
};
imp = {
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"];
};
};
in out