summary refs log tree commit diff
diff options
context:
space:
mode:
authorsuperherointj <5861043+superherointj@users.noreply.github.com>2022-07-31 19:12:59 -0300
committerGitHub <noreply@github.com>2022-07-31 19:12:59 -0300
commit5857574d45925585baffde730369414319228a84 (patch)
treeb6e6bc8ca21cfbf520441515d097a6d5ee2a6a75
parent8ea914999fe5f87757912e6f74a71c7201d5c1a4 (diff)
parent8457d9277a5346360480eeeb9319567ad94fe1e7 (diff)
downloadnixpkgs-5857574d45925585baffde730369414319228a84.tar
nixpkgs-5857574d45925585baffde730369414319228a84.tar.gz
nixpkgs-5857574d45925585baffde730369414319228a84.tar.bz2
nixpkgs-5857574d45925585baffde730369414319228a84.tar.lz
nixpkgs-5857574d45925585baffde730369414319228a84.tar.xz
nixpkgs-5857574d45925585baffde730369414319228a84.tar.zst
nixpkgs-5857574d45925585baffde730369414319228a84.zip
Merge pull request #183307 from Djabx/autoUpgrabe-boot
system.autoUpgrade: add boot option.
-rw-r--r--nixos/modules/tasks/auto-upgrade.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/nixos/modules/tasks/auto-upgrade.nix b/nixos/modules/tasks/auto-upgrade.nix
index 21a25cbfa96..54eee19dc77 100644
--- a/nixos/modules/tasks/auto-upgrade.nix
+++ b/nixos/modules/tasks/auto-upgrade.nix
@@ -21,6 +21,17 @@ in {
         '';
       };
 
+      operation = mkOption {
+        type = types.enum ["switch" "boot"];
+        default = "switch";
+        example = "boot";
+        description = ''
+          Whether to run
+          <literal>nixos-rebuild switch --upgrade</literal> or run
+          <literal>nixos-rebuild boot --upgrade</literal>
+        '';
+      };
+
       flake = mkOption {
         type = types.nullOr types.str;
         default = null;
@@ -223,7 +234,7 @@ in {
         ''}
 
         if [ "''${booted}" = "''${built}" ]; then
-          ${nixos-rebuild} switch ${toString cfg.flags}
+          ${nixos-rebuild} ${cfg.operation} ${toString cfg.flags}
         ${optionalString (cfg.rebootWindow != null) ''
           elif [ "''${do_reboot}" != true ]; then
             echo "Outside of configured reboot window, skipping."
@@ -232,7 +243,7 @@ in {
           ${shutdown} -r +1
         fi
       '' else ''
-        ${nixos-rebuild} switch ${toString (cfg.flags ++ upgradeFlag)}
+        ${nixos-rebuild} ${cfg.operation} ${toString (cfg.flags ++ upgradeFlag)}
       '';
 
       startAt = cfg.dates;