sunshine: 2025.118.151840 -> 2025.122.141614 (#376248)
[NixPkgs.git] / pkgs / by-name / ch / chart-testing / package.nix
blobbc580ea44807a4c74c3575367dd98506e3cbbb90
2   buildGoModule,
3   coreutils,
4   fetchFromGitHub,
5   git,
6   installShellFiles,
7   kubectl,
8   kubernetes-helm,
9   lib,
10   makeWrapper,
11   yamale,
12   yamllint,
15 buildGoModule rec {
16   pname = "chart-testing";
17   version = "3.12.0";
19   src = fetchFromGitHub {
20     owner = "helm";
21     repo = pname;
22     rev = "v${version}";
23     hash = "sha256-q56ZM+YzL7RRC3RD3xO3K0hIDomKun5xmSKuiDTq1cU=";
24   };
26   vendorHash = "sha256-kTlqGZVOppf+WMcFw0T9FVbu9eOWAWzotR8fPPyo2Ms=";
28   postPatch = ''
29     substituteInPlace pkg/config/config.go \
30       --replace "\"/etc/ct\"," "\"$out/etc/ct\","
31   '';
33   ldflags = [
34     "-w"
35     "-s"
36     "-X github.com/helm/chart-testing/v3/ct/cmd.Version=${version}"
37     "-X github.com/helm/chart-testing/v3/ct/cmd.GitCommit=${src.rev}"
38     "-X github.com/helm/chart-testing/v3/ct/cmd.BuildDate=19700101-00:00:00"
39   ];
41   nativeBuildInputs = [
42     installShellFiles
43     makeWrapper
44   ];
46   postInstall = ''
47     install -Dm644 -t $out/etc/ct etc/chart_schema.yaml
48     install -Dm644 -t $out/etc/ct etc/lintconf.yaml
50     installShellCompletion --cmd ct \
51       --bash <($out/bin/ct completion bash) \
52       --zsh <($out/bin/ct completion zsh) \
53       --fish <($out/bin/ct completion fish) \
55     wrapProgram $out/bin/ct --prefix PATH : ${
56       lib.makeBinPath [
57         coreutils
58         git
59         kubectl
60         kubernetes-helm
61         yamale
62         yamllint
63       ]
64     }
65   '';
67   meta = with lib; {
68     description = "Tool for testing Helm charts";
69     homepage = "https://github.com/helm/chart-testing";
70     license = licenses.asl20;
71     maintainers = with maintainers; [ atkinschang ];
72     mainProgram = "ct";
73   };