33 lines
682 B
Nix
33 lines
682 B
Nix
|
{ config
|
||
|
, lib
|
||
|
, pkgs
|
||
|
, ...
|
||
|
}:
|
||
|
|
||
|
with lib;
|
||
|
let
|
||
|
cfg = config.my.services.timers;
|
||
|
in
|
||
|
{
|
||
|
options.my.services.timers.enable = mkEnableOption "timers";
|
||
|
options.my.services.timers.package = mkOption {
|
||
|
type = types.package;
|
||
|
default = pkgs.timers;
|
||
|
};
|
||
|
|
||
|
config = lib.mkIf cfg.enable {
|
||
|
environment.systemPackages = [ cfg.package ];
|
||
|
|
||
|
systemd.user.services.timers-daemon = {
|
||
|
after = [ "graphical-session.target" ];
|
||
|
partOf = [ "graphical-session.target" ];
|
||
|
wantedBy = [ "graphical-session.target" ];
|
||
|
serviceConfig = {
|
||
|
Restart = "always";
|
||
|
RestartSec = "1s";
|
||
|
ExecStart = "${getExe cfg.package} daemon";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|