nixpkgs/pkgs/applications/networking/cluster/helm/chart-testing/default.nix
2022-07-28 04:24:27 +00:00

49 lines
1.3 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "chart-testing";
version = "3.7.0";
src = fetchFromGitHub {
owner = "helm";
repo = pname;
rev = "v${version}";
sha256 = "sha256-wwXHSjb5FeWOx008jpGNzplzRtHyvcxkcHWLOSoaIE0=";
};
vendorSha256 = "sha256-VYa97JaVGadltrUH/2S9QU5ndgAjozKUXtmaN0q478Q=";
postPatch = ''
substituteInPlace pkg/config/config.go \
--replace "\"/etc/ct\"," "\"$out/etc/ct\","
'';
ldflags = [
"-w"
"-s"
"-X github.com/helm/chart-testing/v3/ct/cmd.Version=${version}"
"-X github.com/helm/chart-testing/v3/ct/cmd.GitCommit=${src.rev}"
"-X github.com/helm/chart-testing/v3/ct/cmd.BuildDate=19700101-00:00:00"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
install -Dm644 -t $out/etc/ct etc/chart_schema.yaml
install -Dm644 -t $out/etc/ct etc/lintconf.yaml
installShellCompletion --cmd ct \
--bash <($out/bin/ct completion bash) \
--zsh <($out/bin/ct completion zsh) \
--fish <($out/bin/ct completion fish) \
'';
meta = with lib; {
description = "A tool for testing Helm charts";
homepage = "https://github.com/helm/chart-testing";
license = licenses.asl20;
maintainers = with maintainers; [ atkinschang ];
mainProgram = "ct";
};
}