fix(update_cached_hashes.sh): update script to correctly parse and handle hash changes
This commit is contained in:
parent
ccb4c9e373
commit
dd151c9f1a
@ -5,10 +5,18 @@
|
||||
# (so we don't have to rebuild EVERYTHING)
|
||||
RELEASE=24.11
|
||||
|
||||
set -e
|
||||
|
||||
new=$(curl -sL "https://monitoring.nixos.org/prometheus/api/v1/query?query=channel_revision" | jq -r ".data.result[] | select(.metric.channel==\"nixos-${RELEASE}\") | .metric.revision")
|
||||
old=$(jq -r ".nodes.nixpkgs.locked.rev" flake.lock)
|
||||
old=$(jq -r '.nodes as $nodes | .nodes.root.inputs.nixpkgs as $tgt_nixpkgs | $nodes | to_entries[] | select(.key == $tgt_nixpkgs) | .value.locked.rev' flake.lock)
|
||||
|
||||
echo "Old hash: ${old}"
|
||||
echo "New hash: ${new}"
|
||||
if [ "${old}" != "${new}" ]; then
|
||||
echo "Old hash: ${old}"
|
||||
echo "New hash: ${new}"
|
||||
|
||||
sed -i s/"${old}"/"${new}"/ flake.nix
|
||||
sed -i s/"${old}"/"${new}"/ flake.nix
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "No updates available."
|
||||
|
Loading…
x
Reference in New Issue
Block a user