Automatic upgrading and suspension

Having system.autoUpgrade.persistent set to true, which is the default, ensures that, whenever an upgrade is supposed to happen while the machine is “powered down”, an upgrade will be done soon after NixOS is started. I suppose that the phrase “powered down”, which the manual uses, refers to the machine being switched off. However, what if an upgrade is supposed to happen while the machine is suspended? Is there a mechanism for performing an upgrade after the system’s operation is resumed?

autoUpgrade is implemented with a systemd timer, so the relevant manpage for those is most relevant. systemd.timer(5) - Linux manual page

Basically, if the system is suspended when the timer should fire, the default behavior is for the timer to fire once the system wakes up. But you can add WakeSystem=true to cause it to wake the system when the timer should fire, if the hardware supports it.

1 Like