Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for withExtraComponents option for packages #1750

Open
jakenotjay opened this issue Feb 25, 2025 · 1 comment
Open

Support for withExtraComponents option for packages #1750

jakenotjay opened this issue Feb 25, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@jakenotjay
Copy link

Google cloud doesn't include many of the subcomponents by default on install, and when installed via a package manager, doesn't allow you to add any more components:

gcloud components install pubsub-emulator
ERROR: (gcloud.components.install) You cannot perform this action because this Cloud SDK installation is managed by an external package manager.
Please consider using a separate installation of the Cloud SDK created through the default mechanism described at: https://cloud.google.com/sdk/

Of course, I can get around this currently by adding the following to tasks:

tasks = {
    "google:install-gcloud" = {
      exec = ''
        curl https://sdk.cloud.google.com > install.sh
        bash install.sh --disable-prompts --install-dir=$HOME
      '';
      before = [ "google:add-credentials" ];
      # status only run if 1 is returned, so we can check if gcloud command is available, if we return 0, it will not run
      status = ''
        if ! command -v gcloud &> /dev/null; then
          exit 1
        else
          exit 0
        fi
      '';
    };

    "google:install-pubsub-emulator" = {
      exec = "gcloud components install pubsub-emulator";
      before = [ "devenv:enterShell" ];
      after = [ "google:install-gcloud" ];
    };
};

However, nix has support for withExtraComponents as can be seen here NixOS/nixpkgs#99280

@jakenotjay jakenotjay added the enhancement New feature or request label Feb 25, 2025
@sandydoo
Copy link
Member

sandydoo commented Feb 25, 2025

However, nix has support for withExtraComponents as can be seen here NixOS/nixpkgs#99280

So why not use that?

{ pkgs, ... }: {
  packages = [ 
    (pkgs.google-cloud-sdk.withExtraComponents [ pkgs.google-cloud-sdk.components.pubsub-emulator ])
  ];
}

Or am I missing something here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants