Implement a generic helm templater package.
This commit is contained in:
48
nix/kubernetes/keys/package/helm-manifest/package.nix
Normal file
48
nix/kubernetes/keys/package/helm-manifest/package.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
# unpackPhase
|
||||
# patchPhase
|
||||
# configurePhase
|
||||
# buildPhase
|
||||
# checkPhase
|
||||
# installPhase
|
||||
# fixupPhase
|
||||
# installCheckPhase
|
||||
# distPhase
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
stdenv,
|
||||
kubernetes-helm,
|
||||
helm_src,
|
||||
helm_name,
|
||||
helm_namespace,
|
||||
helm_path ? ".",
|
||||
helm_manifest_name,
|
||||
helm_values ? { },
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation (
|
||||
finalAttrs:
|
||||
let
|
||||
to_yaml_file = ((import ../../../functions/to_yaml.nix) { inherit pkgs; }).to_yaml_file;
|
||||
in
|
||||
{
|
||||
name = "${helm_name}-manifest";
|
||||
nativeBuildInputs = [
|
||||
kubernetes-helm
|
||||
];
|
||||
buildInputs = [ ];
|
||||
|
||||
src = helm_src;
|
||||
|
||||
buildPhase = ''
|
||||
helm template --dry-run=client ${lib.strings.escapeShellArg helm_name} $src/${helm_path} --namespace ${helm_namespace} \
|
||||
--values ${to_yaml_file "values.yaml" helm_values} \
|
||||
| tee $NIX_BUILD_TOP/${helm_manifest_name}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out"
|
||||
cp $NIX_BUILD_TOP/${helm_manifest_name} $out/
|
||||
'';
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user