diff options
author | Alexandre Badez <alexandre@badez.eu> | 2022-07-28 14:23:52 +0200 |
---|---|---|
committer | Alexandre Badez <alexandre@badez.eu> | 2022-07-29 08:21:07 +0200 |
commit | 8457d9277a5346360480eeeb9319567ad94fe1e7 (patch) | |
tree | ffee4d5b6b8836ed7c3ac55d73926ec964e741b1 | |
parent | 2d4cd6f07ff22799f4e2a0f3260b57f4087ed7bc (diff) | |
download | nixpkgs-8457d9277a5346360480eeeb9319567ad94fe1e7.tar nixpkgs-8457d9277a5346360480eeeb9319567ad94fe1e7.tar.gz nixpkgs-8457d9277a5346360480eeeb9319567ad94fe1e7.tar.bz2 nixpkgs-8457d9277a5346360480eeeb9319567ad94fe1e7.tar.lz nixpkgs-8457d9277a5346360480eeeb9319567ad94fe1e7.tar.xz nixpkgs-8457d9277a5346360480eeeb9319567ad94fe1e7.tar.zst nixpkgs-8457d9277a5346360480eeeb9319567ad94fe1e7.zip |
system.autoUpgrade: add boot option.
-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 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; |