Merge pull request #183307 from Djabx/autoUpgrabe-boot
system.autoUpgrade: add boot option.
This commit is contained in:
commit
5857574d45
|
@ -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 {
|
flake = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -223,7 +234,7 @@ in {
|
||||||
''}
|
''}
|
||||||
|
|
||||||
if [ "''${booted}" = "''${built}" ]; then
|
if [ "''${booted}" = "''${built}" ]; then
|
||||||
${nixos-rebuild} switch ${toString cfg.flags}
|
${nixos-rebuild} ${cfg.operation} ${toString cfg.flags}
|
||||||
${optionalString (cfg.rebootWindow != null) ''
|
${optionalString (cfg.rebootWindow != null) ''
|
||||||
elif [ "''${do_reboot}" != true ]; then
|
elif [ "''${do_reboot}" != true ]; then
|
||||||
echo "Outside of configured reboot window, skipping."
|
echo "Outside of configured reboot window, skipping."
|
||||||
|
@ -232,7 +243,7 @@ in {
|
||||||
${shutdown} -r +1
|
${shutdown} -r +1
|
||||||
fi
|
fi
|
||||||
'' else ''
|
'' else ''
|
||||||
${nixos-rebuild} switch ${toString (cfg.flags ++ upgradeFlag)}
|
${nixos-rebuild} ${cfg.operation} ${toString (cfg.flags ++ upgradeFlag)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
startAt = cfg.dates;
|
startAt = cfg.dates;
|
||||||
|
|
Loading…
Reference in a new issue