dotfiles/modules/services/timers.nix

34 lines
725 B
Nix

{ config
, inputs
, 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;
inherit (inputs.timers.packages.${pkgs.system}) default;
};
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";
};
};
};
}