Merge pull request #19668 from groxxda/timers

systemd.timers: automatically convert string to list
This commit is contained in:
Tim Steinbach 2016-10-20 17:37:28 -04:00 committed by GitHub
commit 99d9d32899
3 changed files with 5 additions and 4 deletions

View File

@ -41,7 +41,7 @@ in
systemd.services.nix-optimise = systemd.services.nix-optimise =
{ description = "Nix Store Optimiser"; { description = "Nix Store Optimiser";
serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise"; serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise";
startAt = optional cfg.automatic cfg.dates; startAt = optionals cfg.automatic cfg.dates;
}; };
}; };

View File

@ -316,7 +316,7 @@ in rec {
startAt = mkOption { startAt = mkOption {
type = with types; either str (listOf str); type = with types; either str (listOf str);
default = ""; default = [];
example = "Sun 14:00:00"; example = "Sun 14:00:00";
description = '' description = ''
Automatically start this unit at the given date/time, which Automatically start this unit at the given date/time, which
@ -326,6 +326,7 @@ in rec {
to adding a corresponding timer unit with to adding a corresponding timer unit with
<option>OnCalendar</option> set to the value given here. <option>OnCalendar</option> set to the value given here.
''; '';
apply = v: if isList v then v else [ v ];
}; };
}; };

View File

@ -777,7 +777,7 @@ in
{ wantedBy = [ "timers.target" ]; { wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = service.startAt; timerConfig.OnCalendar = service.startAt;
}) })
(filterAttrs (name: service: service.enable && service.startAt != "") cfg.services); (filterAttrs (name: service: service.enable && service.startAt != []) cfg.services);
# Generate timer units for all services that have a startAt value. # Generate timer units for all services that have a startAt value.
systemd.user.timers = systemd.user.timers =
@ -785,7 +785,7 @@ in
{ wantedBy = [ "timers.target" ]; { wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = service.startAt; timerConfig.OnCalendar = service.startAt;
}) })
(filterAttrs (name: service: service.startAt != "") cfg.user.services); (filterAttrs (name: service: service.startAt != []) cfg.user.services);
systemd.sockets.systemd-journal-gatewayd.wantedBy = systemd.sockets.systemd-journal-gatewayd.wantedBy =
optional config.services.journald.enableHttpGateway "sockets.target"; optional config.services.journald.enableHttpGateway "sockets.target";