From 41a52d55a32ffdd159f4de37d4721a34e12e2fca Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 3 Dec 2023 14:46:51 +0100 Subject: [PATCH] modules/nixfiles: Spread auto upgrade over multiple hours --- modules/nixfiles/nixfiles-system-upgrade.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/nixfiles/nixfiles-system-upgrade.nix b/modules/nixfiles/nixfiles-system-upgrade.nix index 2b8bbcd..a3f29b7 100644 --- a/modules/nixfiles/nixfiles-system-upgrade.nix +++ b/modules/nixfiles/nixfiles-system-upgrade.nix @@ -27,7 +27,14 @@ in Type = "oneshot"; ExecStart = pkgs.nixfiles-system-upgrade + "/bin/nixfiles-system-upgrade --no-confirm${optionalString cfg.allowReboot " --allow-reboot"}"; }; - startAt = "*-*-* 06:47:00"; + }; + systemd.timers.nixfiles-system-auto-upgrade = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*-*-* 05:37:00"; + RandomizedDelaySec = "2h"; + }; + after = [ "network-online.target" ]; }; }; }