From 9f2a705f7f25f048e18a7fb8a321e621b1dc6818 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Tue, 30 Jan 2024 19:04:26 +0100 Subject: [PATCH] nix-optimise: only create timer unit if needed --- nixos/modules/services/misc/nix-optimise.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/misc/nix-optimise.nix b/nixos/modules/services/misc/nix-optimise.nix index 0398229a13da..514855abaee4 100644 --- a/nixos/modules/services/misc/nix-optimise.nix +++ b/nixos/modules/services/misc/nix-optimise.nix @@ -42,9 +42,11 @@ in startAt = lib.optionals cfg.automatic cfg.dates; }; - timers.nix-optimise.timerConfig = { - Persistent = true; - RandomizedDelaySec = 1800; + timers.nix-optimise = lib.mkIf cfg.automatic { + timerConfig = { + Persistent = true; + RandomizedDelaySec = 1800; + }; }; }; };