jetify-com / devbox

Instant, easy, and predictable development environments

Home Page:https://www.jetify.com/devbox/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Helm plugins don't appear to work in devbox

sstarcher opened this issue · comments

What happened?

In my devbox global

* kubernetes-helm@latest
* kubernetes-helmPlugins.helm-diff@latest
  eval "$(devbox global shellenv --init-hook)"
❯ helm plugin list
NAME	VERSION	DESCRIPTION
❯ helm diff
Error: unknown command "diff" for "helm"
Run 'helm --help' for usage.

Steps to reproduce

  1. devbox global add kubernetes-helmPlugins.helm-diff
  2. devbox global add kubernetes-helm
  3. helm plugin list

I would expect the plugin to be installed

Command

No response

devbox.json

{
  "packages": [
    "ripgrep@latest",
    "yq-go@latest",
    "stern@latest",
    "goreleaser@latest",
    "antigen@latest",
    "awscli2@latest",
    "azure-cli@latest",
    "zsh@latest",
    "dive@latest",
    "fzf@latest",
    "git-review@latest",
    "hyperfine@latest",
    "kubectl@latest",
    "kubectx@latest",
    "shellcheck@latest",
    "sops@latest",
    "tflint@latest",
    "yadm@latest",
    "krew@latest",
    "hub@latest",
    "pipenv@latest",
    "zsh-powerlevel10k@latest",
    "jq@latest",
    "terraform@1.5.7",
    "vals@latest",
    "kubernetes-helm@latest",
    "watch@latest",
    "kustomize@5.1.1",
    "dyff@latest",
    "zoxide@latest",
    "helmfile@latest",
    "nodePackages.diff2html-cli@latest",
    "kubernetes-helmPlugins.helm-diff@latest",
    "go@1.20.10",
    "scmpuff@latest"
  ]
}

Devbox version

0.9.1

Nix version

nix (Nix) 2.13.5

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

Note: this is how they're handled in nix directly: https://nixos.wiki/wiki/Helm_and_Helmfile

My knowledge of nix is very limited working on that. I would have expected what I did above with

   "kubernetes-helmPlugins.helm-diff@latest",

to be equivalent of what they recommended below in nix or are you saying I should create a flake and have it referenced by devbox?

{
  environment.systemPackages = with pkgs; [
      (wrapHelm kubernetes-helm {
        plugins = with pkgs.kubernetes-helmPlugins; [
          helm-secrets
          helm-diff
          helm-s3
          helm-git
        ];
      }) 
    ];
}

to be equivalent of what they recommended below in nix

It won't be equivalent. I believe jetpack would need to special case this.

I believe if you make a flake as you mentioned, this will work.

I'm on a m2 macbook. I tried searching for the relevant devbox/nix docs. The invocation of flake-utils.lib.eachDefaultSystem when I hunted down the readme for that library.

With the config pulled from the nixos wiki I get the following error. I apologize for being a complete noob.

Error: error installing package path:.devbox/flakes
source: nix path-info exit code: 1, output: warning: creating lock file '/Users/jameshounshell/git/ml/helm-charts/.devbox/flakes/flake.lock'
error: flake 'path:/Users/jameshounshell/git/ml/helm-charts/.devbox/flakes' does not provide attribute 'packages.aarch64-darwin.default' or 'defaultPackage.aarch64-darwin'
, err: exit status 1

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetpack-io/devbox/0.10.3/.schema/devbox.schema.json",
  "packages": [
    "gh@latest",
    "kubernetes-helm@latest",
    "helm-docs@latest",
    "pre-commit@latest",
    "kubeconform@latest",
    "path:.devbox/flakes"
  ],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

./.devbox/flakes/flake.nix

{
  description = "Nix flake for Helm";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/master";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system}; in
      {
        devShells.default = pkgs.mkShell {
          name = "helm devShell";
          nativeBuildInputs = [ pkgs.bashInteractive ];
          buildInputs = with pkgs; [
            (wrapHelm kubernetes-helm {
              plugins = with pkgs.kubernetes-helmPlugins; [
                helm-diff
                helm-secrets
                helm-s3
              ];
            })
          ];
        };
      });
}

Oh my goodness I ditched the flake thing and got it to work by hackily supplying the HELM_PLUGIN environment variable

{
  "$schema": "https://raw.githubusercontent.com/jetpack-io/devbox/0.10.3/.schema/devbox.schema.json",
  "packages": [
    "gh@latest",
    "kubernetes-helm@latest",
    "helm-docs@latest",
    "pre-commit@latest",
    "kubeconform@latest",
    "kubernetes-helmPlugins.helm-unittest@0.3.5"
  ],
  "env": {
    "HELM_PLUGINS": "$PWD/.devbox/nix/profile/default"
  },
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}