mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
14 lines
682 B
Bash
14 lines
682 B
Bash
updates="$({ cd /home/swarsel/.dotfiles && nix flake lock --update-input nixpkgs && nix build .#nixosConfigurations."$(eval hostname)".config.system.build.toplevel && nvd diff /run/current-system ./result | grep -c '\[U'; } || true)"
|
|
|
|
alt="has-updates"
|
|
if [[ $updates -eq 0 ]]; then
|
|
alt="updated"
|
|
fi
|
|
|
|
tooltip="System updated"
|
|
if [[ $updates != 0 ]]; then
|
|
tooltip=$(cd ~/.dotfiles && nvd diff /run/current-system ./result | grep -e '\[U' | awk '{ for (i=3; i<NF; i++) printf $i " "; if (NF >= 3) print $NF; }' ORS='\\n')
|
|
echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"
|
|
else
|
|
echo "{ \"text\":\"\", \"alt\":\"$alt\", \"tooltip\":\"\" }"
|
|
fi
|