From 2eb8aab42cf8623704904b41f4ffe9783bad7b07 Mon Sep 17 00:00:00 2001 From: Bjørn Forsman Date: Wed, 6 Jul 2016 18:50:05 +0200 Subject: nixos/systemd: disable timer units with service A disabled systemd service with a "startAt" attribute, like this: systemd.services.foo-service = { enable = false; startAt = "*-*-* 05:15:00"; ... }; will cause the following errors in the system journal: systemd[1]: foo-service.timer: Refusing to start, unit to trigger not loaded. systemd[1]: Failed to start foo-service.timer. Fix it by not generating the corresponding timer unit when the service is disabled. --- nixos/modules/system/boot/systemd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nixos/modules/system') diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index b7c09d2e4bfa..5c8cce5066af 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -764,7 +764,7 @@ in { wantedBy = [ "timers.target" ]; timerConfig.OnCalendar = service.startAt; }) - (filterAttrs (name: service: service.startAt != "") cfg.services); + (filterAttrs (name: service: service.enable && service.startAt != "") cfg.services); # Generate timer units for all services that have a ‘startAt’ value. systemd.user.timers = -- cgit 1.4.1