git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #19668 from groxxda/timers

systemd.timers: automatically convert string to list

commit99d9d32899cc73e295364f22208df22b5bdf1583 authorTim Steinbach <NeQuissimus@users.noreply.github.com> dateThu 20 Oct 2016, 17:37 (10 years ago) parent53f77b78bb4fc1
3 files changed+5−4
nixos/modules/services/misc/nix-optimise.nix+1−1 nixos/modules/system/boot/systemd-unit-options.nix+2−1 nixos/modules/system/boot/systemd.nix+2−2
nixos/modules/services/misc/nix-optimise.nix+1−1
@@ -41,7 +41,7 @@ in
4141 systemd.services.nix-optimise =
4242 { description = "Nix Store Optimiser";
4343 serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise";
44− startAt = optional cfg.automatic cfg.dates;
44+ startAt = optionals cfg.automatic cfg.dates;
4545 };
4646
4747 };
nixos/modules/system/boot/systemd-unit-options.nix+2−1
@@ -316,7 +316,7 @@ in rec {
316316
317317 startAt = mkOption {
318318 type = with types; either str (listOf str);
319− default = "";
319+ default = [];
320320 example = "Sun 14:00:00";
321321 description = ''
322322 Automatically start this unit at the given date/time, which
@@ -326,6 +326,7 @@ in rec {
326326 to adding a corresponding timer unit with
327327 <option>OnCalendar</option> set to the value given here.
328328 '';
329+ apply = v: if isList v then v else [ v ];
329330 };
330331
331332 };
nixos/modules/system/boot/systemd.nix+2−2
@@ -777,7 +777,7 @@ in
777777 { wantedBy = [ "timers.target" ];
778778 timerConfig.OnCalendar = service.startAt;
779779 })
780− (filterAttrs (name: service: service.enable && service.startAt != "") cfg.services);
780+ (filterAttrs (name: service: service.enable && service.startAt != []) cfg.services);
781781
782782 # Generate timer units for all services that have a ‘startAt’ value.
783783 systemd.user.timers =
@@ -785,7 +785,7 @@ in
785785 { wantedBy = [ "timers.target" ];
786786 timerConfig.OnCalendar = service.startAt;
787787 })
788− (filterAttrs (name: service: service.startAt != "") cfg.user.services);
788+ (filterAttrs (name: service: service.startAt != []) cfg.user.services);
789789
790790 systemd.sockets.systemd-journal-gatewayd.wantedBy =
791791 optional config.services.journald.enableHttpGateway "sockets.target";