1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash -p nix jq curl
4 CHANNEL_URL
="https://dl.google.com/dl/cloudsdk/channels/rapid"
5 BASE_URL
="$CHANNEL_URL/downloads/google-cloud-sdk"
7 PACKAGE_DIR
=$
(dirname -- "$0")
9 VERSION
=$
(curl
"https://storage.googleapis.com/storage/v1/b/cloud-sdk-release/o?delimiter=/&startOffset=google-cloud-sdk-${UPDATE_NIX_OLD_VERSION}&endOffset=google-cloud-sdk-9" | jq
--raw-output '.items[-1].name | scan("\\d+\\.\\d+\\.\\d+")')
11 function genMainSrc
() {
12 local url
="${BASE_URL}-${VERSION}-${1}-${2}.tar.gz"
14 sha256
=$
(nix-prefetch-url
"$url")
16 echo " url = \"${url}\";"
17 echo " sha256 = \"${sha256}\";"
23 # DO NOT EDIT! This file is generated automatically by update.sh
26 version = "${VERSION}";
27 googleCloudSdkPkgs = {
30 echo " x86_64-linux ="
31 genMainSrc
"linux" "x86_64"
33 echo " x86_64-darwin ="
34 genMainSrc
"darwin" "x86_64"
36 echo " aarch64-linux ="
37 genMainSrc
"linux" "arm"
39 echo " aarch64-darwin ="
40 genMainSrc
"darwin" "arm"
43 genMainSrc
"linux" "x86"
48 } > "${PACKAGE_DIR}/data.nix"
50 curl
"${CHANNEL_URL}/components-v${VERSION}.json" -w "\n" > "${PACKAGE_DIR}/components.json"