Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p nix-prefetch-scripts 3 4set -eou pipefail 5 6version=$1 7 8linux_bucket="https://download.pytorch.org/whl" 9 10url_and_key_list=( 11 "x86_64-linux-38 $linux_bucket/triton-${version}-0-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl triton-${version}-cp38-cp38-linux_x86_64.whl" 12 "x86_64-linux-39 $linux_bucket/triton-${version}-0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl triton-${version}-cp39-cp39-linux_x86_64.whl" 13 "x86_64-linux-310 $linux_bucket/triton-${version}-0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl triton-${version}-cp310-cp310-linux_x86_64.whl" 14 "x86_64-linux-311 $linux_bucket/triton-${version}-0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl triton-${version}-cp311-cp311-linux_x86_64.whl" 15) 16 17hashfile=binary-hashes-"$version".nix 18echo " \"$version\" = {" >> $hashfile 19 20for url_and_key in "${url_and_key_list[@]}"; do 21 key=$(echo "$url_and_key" | cut -d' ' -f1) 22 url=$(echo "$url_and_key" | cut -d' ' -f2) 23 name=$(echo "$url_and_key" | cut -d' ' -f3) 24 25 echo "prefetching ${url}..." 26 hash=$(nix hash to-sri --type sha256 `nix-prefetch-url "$url" --name "$name"`) 27 28 cat << EOF >> $hashfile 29 $key = { 30 name = "$name"; 31 url = "$url"; 32 hash = "$hash"; 33 }; 34EOF 35 36 echo 37done 38 39echo " };" >> $hashfile 40echo "done."