pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / misc / lilypond / update.sh
blobe9c3f48805afb2cb8eed41866cca1ea5c2d85ea0
1 #!/usr/bin/env nix-shell
2 #!nix-shell -I nixpkgs=./. -i bash -p curl gnused nix
4 set -euo pipefail
6 if [ $# -gt 0 ] && [ "$1" = "unstable" ]; then
7 ATTR="lilypond-unstable"
8 FILE="$(dirname "${BASH_SOURCE[@]}")/unstable.nix"
9 QUERY="VERSION_DEVEL="
10 else
11 ATTR="lilypond"
12 FILE="$(dirname "${BASH_SOURCE[@]}")/default.nix"
13 QUERY="VERSION_STABLE="
16 # update version
17 PREV=$(nix eval --raw -f default.nix $ATTR.version)
18 NEXT=$(curl -s 'https://gitlab.com/lilypond/lilypond/-/raw/master/VERSION' | grep "$QUERY" | cut -d= -f2)
19 sed -i "s|$PREV|$NEXT|" "$FILE"
20 echo "[{\"commitMessage\":\"$ATTR: $PREV -> $NEXT\"}]"
22 # update hash
23 PREV=$(nix eval --raw -f default.nix $ATTR.src.outputHash)
24 NEXT=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 $(nix eval --raw -f default.nix $ATTR.src.url)))
25 sed -i "s|$PREV|$NEXT|" "$FILE"