diff options
author | superherointj <5861043+superherointj@users.noreply.github.com> | 2022-07-31 19:12:59 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-31 19:12:59 -0300 |
commit | 5857574d45925585baffde730369414319228a84 (patch) | |
tree | b6e6bc8ca21cfbf520441515d097a6d5ee2a6a75 /nixos/modules | |
parent | 8ea914999fe5f87757912e6f74a71c7201d5c1a4 (diff) | |
parent | 8457d9277a5346360480eeeb9319567ad94fe1e7 (diff) |
Merge pull request #183307 from Djabx/autoUpgrabe-boot
system.autoUpgrade: add boot option.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/tasks/auto-upgrade.nix | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/nixos/modules/tasks/auto-upgrade.nix b/nixos/modules/tasks/auto-upgrade.nix index 21a25cbfa9643..54eee19dc771b 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; |