this post was submitted on 17 Jan 2025
11 points (100.0% liked)

Nix / NixOS

1888 readers
1 users here now

Main links

Videos

founded 2 years ago
MODERATORS
 

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!

you are viewing a single comment's thread
view the rest of the comments
[โ€“] Corbin 5 points 6 days ago (1 children)

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 the nixos-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 set system.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 to boot.kernelParams.

[โ€“] [email protected] 1 points 5 days ago

Autoupdates during times when I'm not using the system might not work, as I usually shut down the PC when it's not in use... ๐Ÿ˜… Looks like the best way to deal with the issue is to try and write an application myself of sorts?

Would love to have a diff before building a new version, but reading this blogpost it seems you can only get one afterwards https://blog.tjll.net/previewing-nixos-system-updates/

Anyways, if I were to make an app myself, although not very reliable, using the [11/22/33] built, logging during the nixos-rebuild command could be a way to get some progressbar I think?