mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat: add update-checker [WIP]
This commit is contained in:
parent
bbaee7acd8
commit
2da6d3182d
8 changed files with 141 additions and 24 deletions
13
scripts/update-checker.sh
Normal file
13
scripts/update-checker.sh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
updates="$(cd ~/.dotfiles && nix flake lock --update-input nixpkgs && nix build .#nixosConfigurations."$HOSTNAME".config.system.build.toplevel && nvd diff /run/current-system ./result | grep -c '\[U')"
|
||||
|
||||
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' )
|
||||
fi
|
||||
|
||||
echo "{ \"text\":\"$updates\", \"alt\":\"$alt\", \"tooltip\":\"$tooltip\" }"
|
||||
Loading…
Add table
Add a link
Reference in a new issue