1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p nix-prefetch-scripts
8 linux_cuda_version
="cu118"
9 linux_bucket
="https://download.pytorch.org/whl/${linux_cuda_version}"
10 darwin_bucket
="https://download.pytorch.org/whl/cpu"
13 "x86_64-linux-38 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp38-cp38-linux_x86_64.whl torchvision-${version}-cp38-cp38-linux_x86_64.whl"
14 "x86_64-linux-39 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp39-cp39-linux_x86_64.whl torchvision-${version}-cp39-cp39-linux_x86_64.whl"
15 "x86_64-linux-310 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp310-cp310-linux_x86_64.whl torchvision-${version}-cp310-cp310-linux_x86_64.whl"
16 "x86_64-linux-311 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp311-cp311-linux_x86_64.whl torchvision-${version}-cp311-cp311-linux_x86_64.whl"
17 "x86_64-darwin-38 $darwin_bucket/torchvision-${version}-cp38-cp38-macosx_10_9_x86_64.whl torchvision-${version}-cp38-cp38-macosx_10_9_x86_64.whl"
18 "x86_64-darwin-39 $darwin_bucket/torchvision-${version}-cp39-cp39-macosx_10_9_x86_64.whl torchvision-${version}-cp39-cp39-macosx_10_9_x86_64.whl"
19 "x86_64-darwin-310 $darwin_bucket/torchvision-${version}-cp310-cp310-macosx_10_9_x86_64.whl torchvision-${version}-cp310-cp310-macosx_10_9_x86_64.whl"
20 "x86_64-darwin-311 $darwin_bucket/torchvision-${version}-cp311-cp311-macosx_10_9_x86_64.whl torchvision-${version}-cp311-cp311-macosx_10_9_x86_64.whl"
21 "aarch64-darwin-38 $darwin_bucket/torchvision-${version}-cp38-cp38-macosx_11_0_arm64.whl torchvision-${version}-cp38-cp38-macosx_11_0_arm64.whl"
22 "aarch64-darwin-39 $darwin_bucket/torchvision-${version}-cp39-cp39-macosx_11_0_arm64.whl torchvision-${version}-cp39-cp39-macosx_11_0_arm64.whl"
23 "aarch64-darwin-310 $darwin_bucket/torchvision-${version}-cp310-cp310-macosx_11_0_arm64.whl torchvision-${version}-cp310-cp310-macosx_11_0_arm64.whl"
24 "aarch64-darwin-311 $darwin_bucket/torchvision-${version}-cp311-cp311-macosx_11_0_arm64.whl torchvision-${version}-cp311-cp311-macosx_11_0_arm64.whl"
27 hashfile
="binary-hashes-$version.nix"
28 echo " \"$version\" = {" >> $hashfile
30 for url_and_key
in "${url_and_key_list[@]}"; do
31 key
=$
(echo "$url_and_key" | cut
-d' ' -f1)
32 url
=$
(echo "$url_and_key" | cut
-d' ' -f2)
33 name
=$
(echo "$url_and_key" | cut
-d' ' -f3)
35 echo "prefetching ${url}..."
36 hash=$
(nix
hash to-sri
--type sha256
`nix-prefetch-url "$url" --name "$name"`)
38 echo " $key = {" >> $hashfile
39 echo " name = \"$name\";" >> $hashfile
40 echo " url = \"$url\";" >> $hashfile
41 echo " hash = \"$hash\";" >> $hashfile
42 echo " };" >> $hashfile
47 echo " };" >> $hashfile