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 =
{ description = "Nix Store Optimiser";
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 {
type = with types; either str (listOf str);
default = "";
default = [];
example = "Sun 14:00:00";
description = ''
Automatically start this unit at the given date/time, which
@ -326,6 +326,7 @@ in rec {
to adding a corresponding timer unit with
<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" ];
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.
systemd.user.timers =
@ -785,7 +785,7 @@ in
{ wantedBy = [ "timers.target" ];
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 =
optional config.services.journald.enableHttpGateway "sockets.target";