I have this shell.nix
:
with import <nixpkgs> { }; let
google-cloud-sdk = with pkgs.google-cloud-sdk; withExtraCompoonents [components.gke-gcloud-plugin];
in mkShell {
name = "env";
buildInputs = [ google-cloud-sdk ];
}
and it works - so I can do nix-shell
and then use the GKE plugin.
What I wanted to do next is install the same plugin globally with nix-env
. Normally I make changes to existing packages with an overlay, but I can’t figure out how to do that. I tried this in ~/.config/nixpkgs/overlays/gcloud.nix
:
self: super: {
google-cloud-sdk = with super.google-cloud-sdk; withExtraComponents [components.gke-gcloud-auth-plugin];
}
but it results in an infinite recursion error. If I change the name of the package
self: super: {
gcloud = with super.google-cloud-sdk; withExtraComponents [components.gke-gcloud-auth-plugin];
}
then it works with nix-shell -p gcloud
but not nix-env -i gcloud
(“error: selector ‘gcloud’ matches no derivations”). So is there a way to break the infinite recursion or fix the nix-env
some other way?