Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1#! /usr/bin/env nix-shell 2#! nix-shell -i bash --pure -p curl cacert jq 3 4set -euo pipefail 5 6cd "$(dirname "${BASH_SOURCE[0]}")" 7DRV_DIR="$PWD" 8 9relinfo=$(curl -sL 'https://api.github.com/repos/keyboardio/chrysalis/releases' | jq 'map(select(.prerelease == false)) | max_by(.tag_name)') 10newver=$(echo "$relinfo" | jq --raw-output '.tag_name' | sed 's|^v||') 11hashurl=$(echo "$relinfo" | jq --raw-output '.assets[] | select(.name == "latest-linux.yml").browser_download_url') 12newhash=$(curl -sL "$hashurl" | grep -Po '^sha512: \K.*') 13 14sed -i package.nix \ 15 -e "/^ version =/ s|\".*\"|\"$newver\"|" \ 16 -e "/sha512-/ s|\".*\"|\"sha512-$newhash\"|" \