nix/graphical/quick-services.nix

60 lines
1.3 KiB
Nix

{
config,
lib,
...
}:
{
options = {
quick = {
services =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
oneShots =
with lib;
mkOption {
type = with types; attrsOf str;
default = { };
};
};
};
config = {
systemd.user.services =
builtins.mapAttrs (name: cmd: {
unitConfig = {
Description = "${name}";
Requires = [
"graphical-session.target"
];
After = [
"graphical-session.target"
"niri.target"
];
PartOf = [ "sysinit-reactivation.target" ];
};
serviceConfig = {
ExecStart = cmd;
};
wantedBy = [ "graphical-session.target" ];
}) config.quick.services
// builtins.mapAttrs (name: cmd: {
unitConfig = {
Description = "${name}";
Requires = [ "graphical-session.target" ];
After = [
"graphical-session.target"
"niri.target"
];
PartOf = [ "sysinit-reactivation.target" ];
};
serviceConfig = {
ExecStart = cmd;
Type = "oneshot";
};
wantedBy = [ "graphical-session.target" ];
}) config.quick.oneShots;
};
}