Desktop notification after nixos-upgrade

Hello there.

I’d love to have a desktop notification telling me when my NixOS got upgraded (I use system.autoUpgrade.enable = true).

Did anybody do this? Or do you know how to do that?

Thanks!

Which desktop environment are you using?
The auto upgrade calls a systemd service and you could write a small service that runs after that.

The ExecStart could be as simple as notify-send "auto upgrade completed, please reboot soon!".

Not quite, since it would need a connection to the user’s dbus. It’d be quite tricky to get that without potentially unsafe hacks.

It is a systemd service so you should be able to add ExecStartPost that runs a notification script.

Another idea could be just triggering another systemd service on failure: https://youtu.be/lFnNBD6kw9k

It should work like described here: Making sure you're not a bot!

Right, that’s kinda what I mean though, neither of those solutions is great.

The “correct” solution between those two is definitely to use services.systembus-notify.enable, but as the warning in that module shows it’s definitely not as simple and clean as using notify-send.

1 Like