summary refs log blame commit diff
path: root/pkgs/applications/networking/cluster/helm/wrapper.nix
blob: b9322290920eaf09443b3c41e7e995876445c397 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
                                             










                             












                                                                         
                                   
                                                                      
















                                               
{ symlinkJoin, lib, makeWrapper, writeText }:

helm:

let
  wrapper = {
    plugins ? [],
    extraMakeWrapperArgs ? ""
  }:
  let

  initialMakeWrapperArgs = [
  ];

  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 = ''
      wrapProgram "$out/bin/helm" \
        "--set" "HELM_PLUGINS" "${pluginsDir}" ${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