Auto-updates are enabled on my system, but they’re so very unpredictable. Just now had one running, I was thinking “why is my PC lagging” until you hear a symphony of USB connect/disconnect sounds and you realise, “ohh, it was auto-update”.
So the question is, is there some kind of way to receive a notification when auto-update is running? Preferably with progressbar. Or maybe a way to get notifications when there are updates available? Thanks!
Can notifications be started from a systemd unit? Kind of.
notify-send
can be invoked from systemd, but getting the correct user notified is non-trivial and I’m not sure how it would be done on NixOS.Can
nixos-rebuild
have a progress bar? Not really. It’s not a process with a predictable end time.Can there be notifications when updates are available? There are scripts out there (like this one which I have never used) which can poll git repositories and run
notify-send
, but that’s not very useful. Instead, it’s worth knowing that most of the cost of auto-upgrade is running thenixos-rebuild
command at all, even if there are no available upgrades!Instead, consider setting
system.autoUpgrade.dates
to a fixed time when you definitely won’t use the computer, and also setsystem.autoUpgrade.persistent
. This will run auto-upgrade on boot in the worst case.Also, USB devices should not be disconnecting on every update. If USB disconnections happen under high load, check
dmesg
for possible hints; you may merely need to add an override toboot.kernelParams
.