0

Oh-my-zsh has a plugin option (plugins = (gcloud, ...)) which allows installing gcloud completions.

When I add "gcloud" to plugins, I expect that the completion will be sourced during shell initialization, but it doesn't work on NixOS (version 19.03).

How to install gcloud completions on NixOS with oh-my-zsh?

1

Instead of adding gcloud to programs.zsh.ohMyZsh.plugins, I found that I had to manually source the completion script. To do this:

Add pkgs.google-cloud-sdk to environment.systemPackages of your configuration.nix file, and then update the zshrc section:

programs.zsh.promptInit = ''
  export CLOUD_SDK_HOME="${pkgs.google-cloud-sdk}"
  source "$CLOUD_SDK_HOME/google-cloud-sdk/completion.zsh.inc"
'';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.