helmfile: set HELM_PLUGINS if pluginsDir is given

This commit is contained in:
Eric Bailey 2023-05-10 12:05:23 -05:00 committed by Eric Bailey
parent 2af5394755
commit 27dab305a6

View File

@ -1,4 +1,10 @@
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, makeWrapper
, pluginsDir ? null
}:
buildGoModule rec {
pname = "helmfile";
@ -19,9 +25,14 @@ buildGoModule rec {
ldflags = [ "-s" "-w" "-X go.szostok.io/version.version=v${version}" ];
nativeBuildInputs = [ installShellFiles ];
nativeBuildInputs =
[ installShellFiles ] ++
lib.optional (pluginsDir != null) makeWrapper;
postInstall = ''
postInstall = lib.optionalString (pluginsDir != null) ''
wrapProgram $out/bin/helmfile \
--set HELM_PLUGINS "${pluginsDir}"
'' + ''
installShellCompletion --cmd helmfile \
--bash <($out/bin/helmfile completion bash) \
--fish <($out/bin/helmfile completion fish) \