about summary refs log tree commit diff
path: root/pkgs/tools/security/kubesec
diff options
context:
space:
mode:
author06kellyjac <dev@j-k.io>2022-07-06 19:11:55 +0100
committer06kellyjac <dev@j-k.io>2022-07-06 19:11:55 +0100
commit7945354659cfa0b9aeea729fd925d2c3151ffd0c (patch)
tree8df6fc8962e1713f631cfe9ff69d21a4a6d48aff /pkgs/tools/security/kubesec
parentc1f05af680f2a1de3abaf1ecc34f1100932b60f7 (diff)
kubesec: 2.11.4 -> 2.11.5
Diffstat (limited to 'pkgs/tools/security/kubesec')
-rw-r--r--pkgs/tools/security/kubesec/default.nix33
1 files changed, 29 insertions, 4 deletions
diff --git a/pkgs/tools/security/kubesec/default.nix b/pkgs/tools/security/kubesec/default.nix
index 001e851912a7c..9a3e2df02b1de 100644
--- a/pkgs/tools/security/kubesec/default.nix
+++ b/pkgs/tools/security/kubesec/default.nix
@@ -1,29 +1,54 @@
 { lib
 , buildGoModule
 , fetchFromGitHub
+, installShellFiles
 }:
 
 buildGoModule rec {
   pname = "kubesec";
-  version = "2.11.4";
+  version = "2.11.5";
 
   src = fetchFromGitHub {
     owner = "controlplaneio";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-z1v+xm0ZWs8F5KtltBSDx9W+xNqRsfvAgQUKgrZa+28=";
+    sha256 = "sha256-SxXYtIoyKe9/M3Ct1qy2QC6pYpt9GOefGsC5nUCoTEA=";
   };
+  vendorSha256 = "sha256-pq4s/Rqu1I1nrTxy5Cn1rt5HO6z7ziKz/9LLpXLYpPc=";
 
-  vendorSha256 = "sha256-t2GZaLa/Pc/TCjqTNGuLnOFSepExmE2xA8pc9HkUtcs=";
+  nativeBuildInputs = [ installShellFiles ];
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X github.com/controlplaneio/kubesec/v${lib.versions.major version}/cmd.version=v${version}"
+  ];
 
   # Tests wants to download the kubernetes schema for use with kubeval
   doCheck = false;
 
+  postInstall = ''
+    installShellCompletion --cmd kubesec \
+      --bash <($out/bin/kubesec completion bash) \
+      --fish <($out/bin/kubesec completion fish) \
+      --zsh <($out/bin/kubesec completion zsh)
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    runHook preInstallCheck
+
+    $out/bin/kubesec --help
+    $out/bin/kubesec version | grep "${version}"
+
+    runHook postInstallCheck
+  '';
+
   meta = with lib; {
     description = "Security risk analysis tool for Kubernetes resources";
     homepage = "https://github.com/controlplaneio/kubesec";
     changelog = "https://github.com/controlplaneio/kubesec/blob/v${version}/CHANGELOG.md";
     license = with licenses; [ asl20 ];
-    maintainers = with maintainers; [ fab ];
+    maintainers = with maintainers; [ fab jk ];
   };
 }