pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / misc / urbit / update-bin.sh
blobb7ee514e10a7b2ac308462fdb85e178b1a194268
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl common-updater-scripts nix-prefetch
4 set -euo pipefail
6 ROOT="$(dirname "$(readlink -f "$0")")"
7 NIX_DRV="$ROOT/default.nix"
8 if [ ! -f "$NIX_DRV" ]; then
9 echo "ERROR: cannot find urbit in $ROOT"
10 exit 1
13 fetch_arch() {
14 VER="$1"; ARCH="$2"
15 URL="https://github.com/urbit/vere/releases/download/vere-v${VER}/${ARCH}.tgz";
16 nix-prefetch "{ stdenv, fetchzip }:
17 stdenv.mkDerivation rec {
18 pname = \"vere\"; version = \"${VER}\";
19 src = fetchzip { url = \"$URL\"; };
24 replace_sha() {
25 sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV"
28 VERE_VER=$(curl https://bootstrap.urbit.org/vere/live/last)
30 VERE_LINUX_AARCH64_SHA256=$(fetch_arch "$VERE_VER" "linux-aarch64")
31 VERE_LINUX_X64_SHA256=$(fetch_arch "$VERE_VER" "linux-x86_64")
32 VERE_DARWIN_AARCH64_SHA256=$(fetch_arch "$VERE_VER" "macos-aarch64")
33 VERE_DARWIN_X64_SHA256=$(fetch_arch "$VERE_VER" "macos-x86_64")
35 sed -i "s/version = \".*\"/version = \"$VERE_VER\"/" "$NIX_DRV"
37 replace_sha "aarch64-linux" "$VERE_LINUX_AARCH64_SHA256"
38 replace_sha "x86_64-linux" "$VERE_LINUX_X64_SHA256"
39 replace_sha "aarch64-darwin" "$VERE_DARWIN_AARCH64_SHA256"
40 replace_sha "x86_64-darwin" "$VERE_DARWIN_X64_SHA256"