Skip to content

Commit

Permalink
nixos/systemd: disable timer units with service
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 2eb8aab)
  • Loading branch information
bjornfor committed Jul 16, 2016
1 parent bd1d9ff commit 00dfa5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nixos/modules/system/boot/systemd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,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 =
Expand Down

0 comments on commit 00dfa5b

Please sign in to comment.