refactor in style of synaptic standard

This commit is contained in:
atagen 2025-07-20 23:35:43 +10:00
parent ce295da1c1
commit 4b6b898854
119 changed files with 1098 additions and 3063 deletions

View file

@ -0,0 +1,59 @@
{
config,
lib,
...
}:
{
config.hm.options = {
quickServices =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
quickOneShots =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
# for specifying an additional systemd target
extraTarget =
with lib;
mkOption {
type = with types; listOf str;
default = [ ];
};
};
config.hm.config = {
systemd.user.services =
builtins.mapAttrs (name: cmd: {
Unit = {
Description = "${name}";
Requires = [ "graphical-session.target" ] ++ config.hm.extraTarget;
After = [ "graphical-session.target" ] ++ config.hm.extraTarget;
};
Service = {
ExecStart = cmd;
};
Install = {
WantedBy = [ "graphical-session.target" ] ++ config.hm.extraTarget;
};
}) config.hm.quickServices
// builtins.mapAttrs (name: cmd: {
Unit = {
Description = "${name}";
After = [ "graphical-session.target" ] ++ config.extraTarget;
};
Service = {
ExecStart = cmd;
Type = "oneshot";
};
Install = {
WantedBy = [ "graphical-session.target" ] ++ config.extraTarget;
};
}) config.hm.quickOneShots;
};
}