google-cloud-sdk: add update script

This commit is contained in:
Mrinal Purohit 2021-11-10 16:43:56 +05:30
parent 30027eb71f
commit 9c8008113a
3 changed files with 86 additions and 30 deletions

View File

@ -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";
};
};
}

View File

@ -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";
};
}

View File

@ -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 <<EOF
# DO NOT EDIT! This file is generated automatically by update.sh
{ }:
{
version = "${VERSION}";
googleCloudSdkPkgs = {
EOF
echo " x86_64-linux ="
genMainSrc "linux" "x86_64"
echo " x86_64-darwin ="
genMainSrc "darwin" "x86_64"
echo " aarch64-linux ="
genMainSrc "linux" "arm"
echo " aarch64-darwin ="
genMainSrc "darwin" "arm"
echo " i686-linux ="
genMainSrc "linux" "x86"
echo " };"
echo "}"
} >data.nix