Google Cloud SDK: Difference between revisions

From NixOS Wiki
imported>MichaelCTS
Add information on how to use google cloud with extra components
 
imported>Hypnosis2839
m →‎Components: fix syntax
 
Line 5: Line 5:
== Components ==
== Components ==


Since the installation of {{ic| gcloud }} is managed by nix, it won't be possible to install them using {{ic| gcloud components install ...}}. Use this snippet to create a pseudo-package with your components in them <ref name="discourseWithExtraComponents />:
Since the installation of {{ic| gcloud}} is managed by nix, it won't be possible to install them using {{ic| gcloud components install ...}}. Use this snippet to create a pseudo-package with your components in them <ref name="discourseWithExtraComponents />:


<syntaxhighlight lang=nix>
<syntaxhighlight lang=nix>
let
let
   gdk = pkgs.google-cloud-sdk.withExtraComponents( with pkgs.google-cloud-sdk.components [
   gdk = pkgs.google-cloud-sdk.withExtraComponents( with pkgs.google-cloud-sdk.components; [
     gke-gcloud-auth-plugin
     gke-gcloud-auth-plugin
   ]);
   ]);
Line 19: Line 19:
}
}
</syntaxhighlight>
</syntaxhighlight>


== References ==
== References ==

Latest revision as of 13:16, 11 September 2023

It it possible to install gcloud and its components using nix. There are two major packages to do so: google-cloud-sdk and google-cloud-sdk-gce , with that later being a version that is optimised to run on Google Cloud itself.


Components

Since the installation of gcloud is managed by nix, it won't be possible to install them using gcloud components install .... Use this snippet to create a pseudo-package with your components in them [1]:

let
  gdk = pkgs.google-cloud-sdk.withExtraComponents( with pkgs.google-cloud-sdk.components; [
    gke-gcloud-auth-plugin
  ]);
in
{
  packages = [
    gdk
  ];
}

References