tv modules: add per-user

This commit is contained in:
tv 2015-11-06 21:29:49 +01:00
parent f58d024f48
commit b54f00c695
2 changed files with 36 additions and 0 deletions

View File

@ -5,5 +5,6 @@ _:
./consul.nix
./ejabberd.nix
./iptables.nix
./per-user.nix
];
}

35
tv/3modules/per-user.nix Normal file
View File

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.tv.per-user;
out = {
options.tv.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 "per-user.${name}" packages;
});
profiles = ["/etc/per-user/$LOGNAME"];
};
};
in out