From 8953ba92a76a4b46b9de0dfcc48f7231f7c909da Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 5 Aug 2017 23:16:18 +0200 Subject: Convert uucp to systemd timers --- custom/uucp.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'custom') diff --git a/custom/uucp.nix b/custom/uucp.nix index a39cf18b..b3026fc1 100644 --- a/custom/uucp.nix +++ b/custom/uucp.nix @@ -129,9 +129,9 @@ in { interval = mkOption { type = types.nullOr types.str; - default = "00 * * * *"; + default = "1h"; description = '' - Specification of when to run `uucico' in format used by cron + Specification of when to run `uucico' in format used by systemd timers The default is to do so every hour ''; }; @@ -282,8 +282,15 @@ in { ExecStart = "${config.security.wrapperDir}/uucico -D -S %i"; }; }; - - services.cron.systemCronJobs = (map (name: "${cfg.interval} ${pkgs.systemd}/bin/systemctl start uucico@${name}.service") (if (cfg.interval != null) then cfg.remoteNodes else [])); + + systemd.timers = let + timer = name: { + name = "uucico@${name}"; + value.timerConfig = { + OnUnitInactiveSec = cfg.interval; + }; + } + in builtins.listToAttrs (map timer (if (cfg.interval != null) then cfg.remoteNodes else [])); networking.networkmanager.dispatcherScripts = optional cfg.nmDispatch { type = "basic"; -- cgit v1.2.3