33 lines
1.0 KiB
Bash
33 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Nomarchy Update Available Script
|
|
# Checks if flake updates are available and returns info for Waybar
|
|
|
|
REPO_DIR=""
|
|
if [ -f "/etc/nixos/flake.nix" ]; then
|
|
REPO_DIR="/etc/nixos"
|
|
elif [ -f "/etc/nomarchy/flake.nix" ]; then
|
|
REPO_DIR="/etc/nomarchy"
|
|
fi
|
|
|
|
if [ -z "$REPO_DIR" ]; then
|
|
echo "Nomarchy repo not found."
|
|
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.
|
|
|
|
# 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 ""
|