summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ray/prefetch.sh
blob: 6be6d515c0b655620475fcd088588132f89929db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/env nix-shell
#! nix-shell -i sh -p jq

outfile="ray-hashes.nix"
# Clear file
rm -f $outfile

prefetch() {
  package_attr="python${1}Packages.ray"
  echo "Fetching hash for $package_attr on $2"

  expr="(import <nixpkgs> { system = \"$2\"; }).$package_attr.src.url"
  url=$(NIX_PATH=.. nix-instantiate --eval -E "$expr" | jq -r)

  sha256=$(nix-prefetch-url "$url")
  hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$sha256")

  echo -e "  cp${1} = \"${hash}\";" >>$outfile
  echo
}

for system in "x86_64-linux" "aarch64-linux" "aarch64-darwin"; do
  echo "${system} = {" >>$outfile
  for python_version in "310" "311" "312" "313"; do
    prefetch "$python_version" "$system"
  done
  echo "};" >>$outfile
done