1#! /usr/bin/env nix-shell
2#! nix-shell -i sh -p jq
3
4outfile="ray-hashes.nix"
5# Clear file
6rm -f $outfile
7
8prefetch() {
9 package_attr="python${1}Packages.ray"
10 echo "Fetching hash for $package_attr on $2"
11
12 expr="(import <nixpkgs> { system = \"$2\"; }).$package_attr.src.url"
13 url=$(NIX_PATH=.. nix-instantiate --eval -E "$expr" | jq -r)
14
15 sha256=$(nix-prefetch-url "$url")
16 hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$sha256")
17
18 echo -e " cp${1} = \"${hash}\";" >>$outfile
19 echo
20}
21
22for system in "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"; do
23 echo "${system} = {" >>$outfile
24 for python_version in "310" "311" "312" "313"; do
25 prefetch "$python_version" "$system"
26 done
27 echo "};" >>$outfile
28done