about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorTim Steinbach <NeQuissimus@users.noreply.github.com>2016-10-20 17:37:28 -0400
committerGitHub <noreply@github.com>2016-10-20 17:37:28 -0400
commit99d9d32899cc73e295364f22208df22b5bdf1583 (patch)
treeb4673fd8d548425a486fc285596bd274207e7be3 /nixos
parent53f77b719c9684cb9363c01d0d72170c8259dbe8 (diff)
parent8bb4fc1039f8f97534bd2ab5cc3f42e7d753a5a0 (diff)
downloadnixlib-99d9d32899cc73e295364f22208df22b5bdf1583.tar
nixlib-99d9d32899cc73e295364f22208df22b5bdf1583.tar.gz
nixlib-99d9d32899cc73e295364f22208df22b5bdf1583.tar.bz2
nixlib-99d9d32899cc73e295364f22208df22b5bdf1583.tar.lz
nixlib-99d9d32899cc73e295364f22208df22b5bdf1583.tar.xz
nixlib-99d9d32899cc73e295364f22208df22b5bdf1583.tar.zst
nixlib-99d9d32899cc73e295364f22208df22b5bdf1583.zip
Merge pull request #19668 from groxxda/timers
systemd.timers: automatically convert string to list
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/nix-optimise.nix2
-rw-r--r--nixos/modules/system/boot/systemd-unit-options.nix3
-rw-r--r--nixos/modules/system/boot/systemd.nix4
3 files changed, 5 insertions, 4 deletions
diff --git a/nixos/modules/services/misc/nix-optimise.nix b/nixos/modules/services/misc/nix-optimise.nix
index 87ce05c5a11b..a76bfd9f1f19 100644
--- a/nixos/modules/services/misc/nix-optimise.nix
+++ b/nixos/modules/services/misc/nix-optimise.nix
@@ -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;
       };
 
   };
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix
index 731b1701e00d..4c3fc30358c1 100644
--- a/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixos/modules/system/boot/systemd-unit-options.nix
@@ -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 ];
     };
 
   };
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index d44c2e234b0f..d1f3f923e5e3 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -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";