1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/applications/networking/cluster/helm/wrapper.nix
Matthieu Coudron b9bf757503 kubernetes-helm: support plugins
also introduce helm-s3, helm-diff, helm-secrets plugin.

You can create a wrapped helm with these plugins via:

  myHelm = final.wrapHelm final.kubernetes-helm-unwrapped {
    plugins = with final.kubernetes-helmPlugins; [ helm-s3 helm-secrets helm-diff ];
  };

Running `helm plugin list` will show you these are available.
2021-03-03 13:50:19 -06:00

49 lines
1 KiB
Nix

{ stdenv, symlinkJoin, lib, makeWrapper
, writeText
}:
helm:
let
wrapper = {
plugins ? [],
extraMakeWrapperArgs ? ""
}:
let
initialMakeWrapperArgs = [
"${helm}/bin/helm" "${placeholder "out"}/bin/helm"
"--argv0" "$0" "--set" "HELM_PLUGINS" "${pluginsDir}"
];
pluginsDir = symlinkJoin {
name = "helm-plugins";
paths = plugins;
};
in
symlinkJoin {
name = "helm-${lib.getVersion helm}";
# Remove the symlinks created by symlinkJoin which we need to perform
# extra actions upon
postBuild = ''
rm $out/bin/helm
makeWrapper ${lib.escapeShellArgs initialMakeWrapperArgs} ${extraMakeWrapperArgs}
'';
paths = [ helm pluginsDir ];
preferLocalBuild = true;
nativeBuildInputs = [ makeWrapper ];
passthru = { unwrapped = helm; };
meta = helm.meta // {
# To prevent builds on hydra
hydraPlatforms = [];
# prefer wrapper over the package
priority = (helm.meta.priority or 0) - 1;
};
};
in
lib.makeOverridable wrapper