44 lines
767 B
Nix
44 lines
767 B
Nix
{
|
|
pkgs ? import <nixpkgs> {}
|
|
, helm ? "${pkgs.kubernetes-helm}/bin/helm"
|
|
, lib ? pkgs.lib
|
|
}:
|
|
let
|
|
mkHelm = {
|
|
name,
|
|
version,
|
|
url,
|
|
hash ? lib.fakeSha25,
|
|
namespace ? "",
|
|
patches ? []
|
|
}:
|
|
pkgs.stdenv.mkDerivation {
|
|
inherit name patches;
|
|
|
|
src = pkgs.fetchurl {
|
|
inherit url hash;
|
|
};
|
|
|
|
phases = [
|
|
"unpackPhase"
|
|
"patchPhase"
|
|
"build"
|
|
];
|
|
|
|
namespace = if namespace != "" then "--namespace ${namespace}" else "";
|
|
|
|
build = ''
|
|
mkdir -p $out
|
|
${helm} template \
|
|
--namespace ${namespace} \
|
|
${name} ./ > $out/${name}-${version}.yaml
|
|
${helm} version > $out/VERSION
|
|
'';
|
|
};
|
|
|
|
nixHelm = {
|
|
inherit mkHelm;
|
|
};
|
|
in
|
|
nixHelm
|