From c9941c4b5ef7acc1cb8d734acb383410d99c01ba Mon Sep 17 00:00:00 2001 From: Alexander Ried Date: Wed, 19 Oct 2016 02:06:32 +0200 Subject: [PATCH 1/3] systemd.timers.startOn: automatically convert string to list --- nixos/modules/system/boot/systemd-unit-options.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 set to the value given here. ''; + apply = v: if isList v then v else [ v ]; }; }; From 89ef1a1756098bd9afd857484bf9581e37af6069 Mon Sep 17 00:00:00 2001 From: Alexander Ried Date: Wed, 19 Oct 2016 02:06:59 +0200 Subject: [PATCH 2/3] nix-optimise module: fix startAt --- nixos/modules/services/misc/nix-optimise.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }; }; From 8bb4fc1039f8f97534bd2ab5cc3f42e7d753a5a0 Mon Sep 17 00:00:00 2001 From: Alexander Ried Date: Wed, 19 Oct 2016 02:10:46 +0200 Subject: [PATCH 3/3] systemd.timers: filter timers with empty startAt --- nixos/modules/system/boot/systemd.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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";