A simple Waybar update checking script for NixOS. It is a general script and could work with other bars or just be run in the terminal.
Here's how the module looks in Waybar with and without updates:
Here's how the module's tooltip looks when updates are available:
This script assumes your flake is in ~/.dotfiles and that your flake's nixosConfigurations is named the same as your $hostname
Credit goes to this project for the idea and starting point.
Download the update-checker
script, put it in your PATH and make it executable (chmod +x update-checker
).
To configure, add the following to your Waybar config (~/.config/waybar/config
).
"custom/nix-updates": {
"exec": "$HOME/bin/update-checker", // <--- path to script
"on-click": "$HOME/bin/update-checker && notify-send 'The system has been updated'", // refresh on click
"interval": 3600, // refresh every hour
"tooltip": true,
"return-type": "json",
"format": "{} {icon}",
"format-icons": {
"has-updates": "", // icon when updates needed
"updated": "" // icon when all packages updated
},
},
To style use the #custom-nix-updates
ID in your Waybar styles file (~/.config/waybar/styles.css
).
For more information see the Waybar wiki.