From b6cad64ef6cbbfe48b920bfab51a41eeefe8b636 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Thu, 27 Feb 2020 16:40:10 -0500 Subject: [PATCH 1/3] NixOS/auto-upgrade: Add optional randomized delay --- nixos/modules/tasks/auto-upgrade.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/modules/tasks/auto-upgrade.nix b/nixos/modules/tasks/auto-upgrade.nix index 7fe06699191..57ca7cd9419 100644 --- a/nixos/modules/tasks/auto-upgrade.nix +++ b/nixos/modules/tasks/auto-upgrade.nix @@ -63,6 +63,17 @@ let cfg = config.system.autoUpgrade; in ''; }; + randomizedDelaySec = mkOption { + default = "0"; + type = types.str; + example = "45min"; + description = '' + Add a randomized delay to wait before automatically upgrading. + The delay will be between zero and this value. + This value must be a valid systemd timestamp. + ''; + }; + }; }; @@ -109,6 +120,8 @@ let cfg = config.system.autoUpgrade; in startAt = cfg.dates; }; + systemd.timers.nixos-upgrade.timerConfig.RandomizedDelaySec = cfg.randomizedDelaySec; + }; } From 14a1aa4a3dbfbde733cbc133828cfca951e8bdf6 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Fri, 28 Feb 2020 12:03:41 -0500 Subject: [PATCH 2/3] NixOS/auto-upgrade: fix wording Co-Authored-By: Pascal Hertleif --- nixos/modules/tasks/auto-upgrade.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/tasks/auto-upgrade.nix b/nixos/modules/tasks/auto-upgrade.nix index 57ca7cd9419..6eaa40613d1 100644 --- a/nixos/modules/tasks/auto-upgrade.nix +++ b/nixos/modules/tasks/auto-upgrade.nix @@ -70,7 +70,7 @@ let cfg = config.system.autoUpgrade; in description = '' Add a randomized delay to wait before automatically upgrading. The delay will be between zero and this value. - This value must be a valid systemd timestamp. + This value must be a valid systemd timespan. ''; }; From 9d3aa711fe64868aa5a7ac5038a39b861cacefdb Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Tue, 3 Mar 2020 22:14:31 -0500 Subject: [PATCH 3/3] NixOS/auto-upgrade: refine option description --- nixos/modules/tasks/auto-upgrade.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/modules/tasks/auto-upgrade.nix b/nixos/modules/tasks/auto-upgrade.nix index 6eaa40613d1..bfc1e301efa 100644 --- a/nixos/modules/tasks/auto-upgrade.nix +++ b/nixos/modules/tasks/auto-upgrade.nix @@ -68,9 +68,11 @@ let cfg = config.system.autoUpgrade; in type = types.str; example = "45min"; description = '' - Add a randomized delay to wait before automatically upgrading. - The delay will be between zero and this value. - This value must be a valid systemd timespan. + Add a randomized delay before each automatic upgrade. + The delay will be chozen between zero and this value. + This value must be a time span in the format specified by + systemd.time + 7 ''; };