base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ku / kubesec / package.nix
blob15485adf9b2ff3367e97999f598a46513be9b103
1 { lib
2 , buildGoModule
3 , fetchFromGitHub
4 , installShellFiles
5 }:
7 buildGoModule rec {
8   pname = "kubesec";
9   version = "2.14.1";
11   src = fetchFromGitHub {
12     owner = "controlplaneio";
13     repo = pname;
14     rev = "v${version}";
15     sha256 = "sha256-FYYMCouZuG0EqvganPLSrLgaDZ+JowUcYXTnKMJ+6Us=";
16   };
17   vendorHash = "sha256-KTmsCbFRHMd1KnBYxwWWuETaTP0G3NYCK/ttgrFy59I=";
19   nativeBuildInputs = [ installShellFiles ];
21   ldflags = [
22     "-s"
23     "-w"
24     "-X github.com/controlplaneio/kubesec/v${lib.versions.major version}/cmd.version=v${version}"
25   ];
27   # Tests wants to download the kubernetes schema for use with kubeval
28   doCheck = false;
30   postInstall = ''
31     installShellCompletion --cmd kubesec \
32       --bash <($out/bin/kubesec completion bash) \
33       --fish <($out/bin/kubesec completion fish) \
34       --zsh <($out/bin/kubesec completion zsh)
35   '';
37   doInstallCheck = true;
38   installCheckPhase = ''
39     runHook preInstallCheck
41     $out/bin/kubesec --help
42     $out/bin/kubesec version | grep "${version}"
44     runHook postInstallCheck
45   '';
47   meta = with lib; {
48     description = "Security risk analysis tool for Kubernetes resources";
49     mainProgram = "kubesec";
50     homepage = "https://github.com/controlplaneio/kubesec";
51     changelog = "https://github.com/controlplaneio/kubesec/blob/v${version}/CHANGELOG.md";
52     license = with licenses; [ asl20 ];
53     maintainers = with maintainers; [ fab jk ];
54   };