1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gnused gawk nix-prefetch
6 ROOT
="$(dirname "$
(readlink
-f "$0")")"
7 NIX_DRV
="$ROOT/default.nix"
8 if [ ! -f "$NIX_DRV" ]; then
9 echo "ERROR: cannot find default.nix in $ROOT"
15 URL
="https://github.com/openziti/zrok/releases/download/v${VER}/zrok_${VER}_${ARCH}.tar.gz"
16 nix-prefetch
"{ stdenv, fetchzip }:
17 stdenv.mkDerivation rec {
18 pname = \"zrok\"; version = \"${VER}\";
19 src = fetchzip { url = \"$URL\"; stripRoot = false; };
25 sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV"
28 ZROK_VER
=$
(curl
-Ls -w "%{url_effective}" -o /dev
/null https
://github.com
/openziti
/zrok
/releases
/latest |
awk -F'/' '{print $NF}' |
sed 's/v//')
30 ZROK_LINUX_X64_SHA256
=$
(fetch_arch
"$ZROK_VER" "linux_amd64")
31 ZROK_LINUX_AARCH64_SHA256
=$
(fetch_arch
"$ZROK_VER" "linux_arm64")
32 ZROK_LINUX_ARMV7L_SHA256
=$
(fetch_arch
"$ZROK_VER" "linux_armv7")
34 sed -i "s/version = \".*\"/version = \"$ZROK_VER\"/" "$NIX_DRV"
36 replace_sha
"x86_64-linux" "$ZROK_LINUX_X64_SHA256"
37 replace_sha
"aarch64-linux" "$ZROK_LINUX_AARCH64_SHA256"
38 replace_sha
"armv7l-linux" "$ZROK_LINUX_ARMV7L_SHA256"