1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl jq gnused
6 cd "$(dirname "$0")" ||
exit 1
8 # Grab latest release version
9 LOOPWM_LATEST_VER
="$(curl --fail -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https
://api.github.com
/repos
/MrKai77
/Loop
/releases
/latest
" | jq -r '.tag_name' | sed 's/^v//')"
10 LOOPWM_CURRENT_VER
="$(grep -oP 'version = "\K
[^
"]+' package.nix)"
12 if [[ "$LOOPWM_LATEST_VER" == "$LOOPWM_CURRENT_VER" ]]; then
13 echo "loopwm is up-to-date"
17 LOOPWM_DARWIN_HASH
="$(nix-hash --to-sri --type sha256 "$
(nix-prefetch-url
--type sha256
"https://github.com/MrKai77/Loop/releases/download/${LOOPWM_LATEST_VER}/Loop.zip")")"
19 sed -i "s#hash = \".*\"#hash = \"$LOOPWM_DARWIN_HASH\"#g" package.nix
20 sed -i "s#version = \".*\";#version = \"$LOOPWM_LATEST_VER\";#g" package.nix