fix(scripts): improve offline resilience and restore missing update scripts
All checks were successful
Check / eval-and-lint (push) Successful in 7m5s
All checks were successful
Check / eval-and-lint (push) Successful in 7m5s
This commit is contained in:
@@ -16,18 +16,14 @@ if [ -z "$REPO_DIR" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# We use a simple logic: Check for flake updates periodically.
|
||||
# Since this is run by Waybar, we should be careful with performance.
|
||||
|
||||
# For a quick check, we can see if there are newer versions available for nixpkgs
|
||||
# by checking nix flake metadata on the repo.
|
||||
# Fast-fail if offline to avoid expensive nix commands.
|
||||
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get current status
|
||||
CURRENT_REV=$(nix flake metadata "$REPO_DIR" --json | jq -r '.lock.nodes.root.inputs.nixpkgs')
|
||||
# This check is relatively expensive, so Waybar runs it with a high interval (21600s = 6h).
|
||||
|
||||
# Just return an icon if we are in a system that can be updated.
|
||||
# In a real implementation, we could compare local flake.lock vs upstream if it's a git repo.
|
||||
# For now, we'll return the update icon to show it's active.
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user