about summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorSean Buckley <sean.bck@gmail.com>2020-02-27 16:40:10 -0500
committerSean Buckley <sean.bck@gmail.com>2020-02-27 16:40:10 -0500
commitb6cad64ef6cbbfe48b920bfab51a41eeefe8b636 (patch)
tree506379e073395ccdd11c8fb4a3068722ea17cb2b /nixos/modules/tasks
parentb1ec189c9faa017e7a8dc3aa3b8243da3d61b8c7 (diff)
downloadnixlib-b6cad64ef6cbbfe48b920bfab51a41eeefe8b636.tar
nixlib-b6cad64ef6cbbfe48b920bfab51a41eeefe8b636.tar.gz
nixlib-b6cad64ef6cbbfe48b920bfab51a41eeefe8b636.tar.bz2
nixlib-b6cad64ef6cbbfe48b920bfab51a41eeefe8b636.tar.lz
nixlib-b6cad64ef6cbbfe48b920bfab51a41eeefe8b636.tar.xz
nixlib-b6cad64ef6cbbfe48b920bfab51a41eeefe8b636.tar.zst
nixlib-b6cad64ef6cbbfe48b920bfab51a41eeefe8b636.zip
NixOS/auto-upgrade: Add optional randomized delay
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/auto-upgrade.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/tasks/auto-upgrade.nix b/nixos/modules/tasks/auto-upgrade.nix
index 7fe066991918..57ca7cd94194 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;
+
   };
 
 }