Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 49 lines 2.9 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p nix-prefetch-scripts 3 4set -eou pipefail 5 6version=$1 7 8linux_cuda_version="cu124" 9linux_cuda_bucket="https://download.pytorch.org/whl/${linux_cuda_version}" 10linux_cpu_bucket="https://download.pytorch.org/whl/cpu" 11darwin_bucket="https://download.pytorch.org/whl/cpu" 12 13url_and_key_list=( 14 "x86_64-linux-39 $linux_cuda_bucket/torch-${version}%2B${linux_cuda_version}-cp39-cp39-linux_x86_64.whl torch-${version}-cp39-cp39-linux_x86_64.whl" 15 "x86_64-linux-310 $linux_cuda_bucket/torch-${version}%2B${linux_cuda_version}-cp310-cp310-linux_x86_64.whl torch-${version}-cp310-cp310-linux_x86_64.whl" 16 "x86_64-linux-311 $linux_cuda_bucket/torch-${version}%2B${linux_cuda_version}-cp311-cp311-linux_x86_64.whl torch-${version}-cp311-cp311-linux_x86_64.whl" 17 "x86_64-linux-312 $linux_cuda_bucket/torch-${version}%2B${linux_cuda_version}-cp312-cp312-linux_x86_64.whl torch-${version}-cp312-cp312-linux_x86_64.whl" 18 "aarch64-darwin-39 $darwin_bucket/torch-${version}-cp39-none-macosx_11_0_arm64.whl torch-${version}-cp39-none-macosx_11_0_arm64.whl" 19 "aarch64-darwin-310 $darwin_bucket/torch-${version}-cp310-none-macosx_11_0_arm64.whl torch-${version}-cp310-none-macosx_11_0_arm64.whl" 20 "aarch64-darwin-311 $darwin_bucket/torch-${version}-cp311-none-macosx_11_0_arm64.whl torch-${version}-cp311-none-macosx_11_0_arm64.whl" 21 "aarch64-darwin-312 $darwin_bucket/torch-${version}-cp312-none-macosx_11_0_arm64.whl torch-${version}-cp312-none-macosx_11_0_arm64.whl" 22 "aarch64-linux-39 $linux_cpu_bucket/torch-${version}-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl torch-${version}-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" 23 "aarch64-linux-310 $linux_cpu_bucket/torch-${version}-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl torch-${version}-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" 24 "aarch64-linux-311 $linux_cpu_bucket/torch-${version}-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl torch-${version}-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" 25 "aarch64-linux-312 $linux_cpu_bucket/torch-${version}-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl torch-${version}-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" 26) 27 28hashfile="binary-hashes-$version.nix" 29echo " \"$version\" = {" >> $hashfile 30 31for url_and_key in "${url_and_key_list[@]}"; do 32 key=$(echo "$url_and_key" | cut -d' ' -f1) 33 url=$(echo "$url_and_key" | cut -d' ' -f2) 34 name=$(echo "$url_and_key" | cut -d' ' -f3) 35 36 echo "prefetching ${url}..." 37 hash=$(nix hash convert --hash-algo sha256 `nix-prefetch-url "$url" --name "$name"`) 38 39 echo " $key = {" >> $hashfile 40 echo " name = \"$name\";" >> $hashfile 41 echo " url = \"$url\";" >> $hashfile 42 echo " hash = \"$hash\";" >> $hashfile 43 echo " };" >> $hashfile 44 45 echo 46done 47 48echo " };" >> $hashfile 49echo "done."