44 lines
767 B
Nix
Raw Normal View History

2024-03-20 23:30:01 +01:00
{
pkgs ? import <nixpkgs> {}
, helm ? "${pkgs.kubernetes-helm}/bin/helm"
, lib ? pkgs.lib
}:
let
2024-03-21 22:25:22 +01:00
mkHelm = {
name,
version,
url,
hash ? lib.fakeSha25,
namespace ? "",
patches ? []
}:
2024-03-20 23:30:01 +01:00
pkgs.stdenv.mkDerivation {
2024-03-21 22:25:22 +01:00
inherit name patches;
2024-03-20 23:30:01 +01:00
src = pkgs.fetchurl {
inherit url hash;
};
phases = [
"unpackPhase"
2024-03-21 22:25:22 +01:00
"patchPhase"
2024-03-20 23:30:01 +01:00
"build"
];
2024-03-21 22:25:22 +01:00
namespace = if namespace != "" then "--namespace ${namespace}" else "";
2024-03-20 23:30:01 +01:00
build = ''
mkdir -p $out
2024-03-21 22:25:22 +01:00
${helm} template \
--namespace ${namespace} \
${name} ./ > $out/${name}-${version}.yaml
${helm} version > $out/VERSION
2024-03-20 23:30:01 +01:00
'';
};
nixHelm = {
inherit mkHelm;
};
in
nixHelm