modularise home conf
This commit is contained in:
parent
b07d950147
commit
4477d0d4a2
23 changed files with 1152 additions and 855 deletions
51
home/util/ez.nix
Normal file
51
home/util/ez.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
ezServices = with lib;
|
||||
mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = {};
|
||||
};
|
||||
ezConf = with lib;
|
||||
mkOption {
|
||||
type = with types; attrsOf path;
|
||||
default = {};
|
||||
};
|
||||
|
||||
# for launching a systemd target on wm startup
|
||||
extraTarget = with lib;
|
||||
mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
config = rec {
|
||||
systemd.user.services = with pkgs;
|
||||
builtins.mapAttrs (name: cmd: {
|
||||
Unit = {
|
||||
Description = "${name}";
|
||||
Requires = ["graphical-session.target"] ++ config.extraTarget;
|
||||
After = ["graphical-session.target"] ++ config.extraTarget;
|
||||
};
|
||||
Service = {
|
||||
ExecStart = cmd;
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["graphical-session.target"] ++ config.extraTarget;
|
||||
};
|
||||
})
|
||||
config.ezServices;
|
||||
|
||||
xdg.configFile =
|
||||
builtins.mapAttrs (name: value: {
|
||||
enable = true;
|
||||
source = value;
|
||||
})
|
||||
config.ezConf;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue