per-user module: factor away api and imp

This commit is contained in:
tv 2017-11-12 09:43:25 +01:00
parent 2409647272
commit ae4cb860ea

View File

@ -1,28 +1,19 @@
{ config, lib, pkgs, ... }:
with import <stockholm/lib>; with import <stockholm/lib>;
{ config, pkgs, ... }: let
let
cfg = config.krebs.per-user; cfg = config.krebs.per-user;
in {
out = { options.krebs.per-user = mkOption {
options.krebs.per-user = api; type = types.attrsOf (types.submodule {
config = imp;
};
api = mkOption {
type = with types; attrsOf (submodule {
options = { options = {
packages = mkOption { packages = mkOption {
type = listOf path; type = types.listOf types.path;
default = []; default = [];
}; };
}; };
}); });
default = {}; default = {};
}; };
config = {
imp = {
environment = { environment = {
etc = flip mapAttrs' cfg (name: { packages, ... }: { etc = flip mapAttrs' cfg (name: { packages, ... }: {
name = "per-user/${name}"; name = "per-user/${name}";
@ -34,5 +25,4 @@ let
profiles = ["/etc/per-user/$LOGNAME"]; profiles = ["/etc/per-user/$LOGNAME"];
}; };
}; };
}
in out