diff --git a/pkgs/tools/admin/google-cloud-sdk/data.nix b/pkgs/tools/admin/google-cloud-sdk/data.nix new file mode 100644 index 000000000000..b278e33d1dc9 --- /dev/null +++ b/pkgs/tools/admin/google-cloud-sdk/data.nix @@ -0,0 +1,32 @@ +# DO NOT EDIT! This file is generated automatically by update.sh +{ }: +{ + version = "364.0.0"; + googleCloudSdkPkgs = { + x86_64-linux = + { + url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-364.0.0-linux-x86_64.tar.gz"; + sha256 = "0i9h61qsd0pmvypjkmp8nzgrdr3n6wdvmizrsnm9azrsmsqbx4cl"; + }; + x86_64-darwin = + { + url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-364.0.0-darwin-x86_64.tar.gz"; + sha256 = "0p2jpzkd0mn70wvs5m6xh9v1f5wfxww6miz2xgd50wa71kh5q9hl"; + }; + aarch64-linux = + { + url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-364.0.0-linux-arm.tar.gz"; + sha256 = "0v8hrymq0iwrw936v7bll012gi20zrhjn4jjgn940y5rrdz7pk2i"; + }; + aarch64-darwin = + { + url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-364.0.0-darwin-arm.tar.gz"; + sha256 = "0lp5l79dm263ymm32abkz7hnfb9zwhwi9xspr2gx8h4jgpw4hmxm"; + }; + i686-linux = + { + url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-364.0.0-linux-x86.tar.gz"; + sha256 = "1cfh5bx7zcjbjqbsin4aqd10jlaibbckgjpp16lh4aywrysdfdzh"; + }; + }; +} diff --git a/pkgs/tools/admin/google-cloud-sdk/default.nix b/pkgs/tools/admin/google-cloud-sdk/default.nix index 4c6debae82b1..c5e376f1c9ab 100644 --- a/pkgs/tools/admin/google-cloud-sdk/default.nix +++ b/pkgs/tools/admin/google-cloud-sdk/default.nix @@ -17,39 +17,15 @@ let crcmod ] ++ lib.optional (with-gce) google-compute-engine); - baseUrl = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads"; - sources = name: system: { - x86_64-darwin = { - url = "${baseUrl}/${name}-darwin-x86_64.tar.gz"; - sha256 = "0p2jpzkd0mn70wvs5m6xh9v1f5wfxww6miz2xgd50wa71kh5q9hl"; - }; - - aarch64-darwin = { - url = "${baseUrl}/${name}-darwin-arm.tar.gz"; - sha256 = "0lp5l79dm263ymm32abkz7hnfb9zwhwi9xspr2gx8h4jgpw4hmxm"; - }; - - x86_64-linux = { - url = "${baseUrl}/${name}-linux-x86_64.tar.gz"; - sha256 = "0i9h61qsd0pmvypjkmp8nzgrdr3n6wdvmizrsnm9azrsmsqbx4cl"; - }; - - i686-linux = { - url = "${baseUrl}/${name}-linux-x86.tar.gz"; - sha256 = "1cfh5bx7zcjbjqbsin4aqd10jlaibbckgjpp16lh4aywrysdfdzh"; - }; - - aarch64-linux = { - url = "${baseUrl}/${name}-linux-arm.tar.gz"; - sha256 = "0v8hrymq0iwrw936v7bll012gi20zrhjn4jjgn940y5rrdz7pk2i"; - }; - }.${system} or (throw "Unsupported system: ${system}"); + data = import ./data.nix { }; + sources = system: + data.googleCloudSdkPkgs.${system} or (throw "Unsupported system: ${system}"); in stdenv.mkDerivation rec { pname = "google-cloud-sdk"; - version = "364.0.0"; + inherit (data) version; - src = fetchurl (sources "${pname}-${version}" stdenv.hostPlatform.system); + src = fetchurl (sources stdenv.hostPlatform.system); buildInputs = [ python ]; @@ -128,8 +104,9 @@ in stdenv.mkDerivation rec { # This package contains vendored dependencies. All have free licenses. license = licenses.free; homepage = "https://cloud.google.com/sdk/"; + changelog = "https://cloud.google.com/sdk/docs/release-notes"; maintainers = with maintainers; [ iammrinal0 pradyuman stephenmw zimbatm ]; - platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + platforms = builtins.attrNames data.googleCloudSdkPkgs; mainProgram = "gcloud"; }; } diff --git a/pkgs/tools/admin/google-cloud-sdk/update.sh b/pkgs/tools/admin/google-cloud-sdk/update.sh new file mode 100755 index 000000000000..87c595f55e7d --- /dev/null +++ b/pkgs/tools/admin/google-cloud-sdk/update.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash -p nix + +BASE_URL="https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk" + +# Version of Google Cloud SDK from +# https://cloud.google.com/sdk/docs/release-notes +VERSION="364.0.0" + +function genMainSrc() { + local url="${BASE_URL}-${VERSION}-${1}-${2}.tar.gz" + local sha256 + sha256=$(nix-prefetch-url "$url") + echo " {" + echo " url = \"${url}\";" + echo " sha256 = \"${sha256}\";" + echo " };" +} + +{ + cat <data.nix