From 421f0d3c90071402194b760b58ee775ed5c763fc Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 3 Dec 2023 11:04:27 +0100 Subject: [PATCH 1/3] flake.lock: Update input nixpkgs --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index f204604..51524ac 100644 --- a/flake.lock +++ b/flake.lock @@ -212,11 +212,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1699099776, - "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", + "lastModified": 1701253981, + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", "type": "github" }, "original": { From 37c838836ed79667b3092acef6444afd0730683d Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 3 Dec 2023 11:28:41 +0100 Subject: [PATCH 2/3] modules/nixfiles: Make nixfiles system upgrade not stop itself during upgrade --- modules/nixfiles/nixfiles-system-upgrade.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/nixfiles/nixfiles-system-upgrade.nix b/modules/nixfiles/nixfiles-system-upgrade.nix index 546478b..2b8bbcd 100644 --- a/modules/nixfiles/nixfiles-system-upgrade.nix +++ b/modules/nixfiles/nixfiles-system-upgrade.nix @@ -19,6 +19,10 @@ in }; config = mkIf cfg.enable { systemd.services.nixfiles-system-auto-upgrade = { + # Make sure this unit does not stop themself while upgrading + restartIfChanged = false; + unitConfig.X-StopOnRemoval = false; + serviceConfig = { Type = "oneshot"; ExecStart = pkgs.nixfiles-system-upgrade + "/bin/nixfiles-system-upgrade --no-confirm${optionalString cfg.allowReboot " --allow-reboot"}"; From 41a52d55a32ffdd159f4de37d4721a34e12e2fca Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 3 Dec 2023 14:46:51 +0100 Subject: [PATCH 3/3] 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" ]; }; }; }