about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/gitleaks/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/gitleaks/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/gitleaks/default.nix28
1 files changed, 24 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/tools/security/gitleaks/default.nix b/nixpkgs/pkgs/tools/security/gitleaks/default.nix
index 5a0d90218f3e..19a186a44501 100644
--- a/nixpkgs/pkgs/tools/security/gitleaks/default.nix
+++ b/nixpkgs/pkgs/tools/security/gitleaks/default.nix
@@ -1,30 +1,49 @@
 { lib
 , buildGoModule
 , fetchFromGitHub
+, gitleaks
+, installShellFiles
+, testers
 }:
 
 buildGoModule rec {
   pname = "gitleaks";
-  version = "8.11.0";
+  version = "8.16.4";
 
   src = fetchFromGitHub {
     owner = "zricethezav";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-6zuxEEJlSppR6yBWNKjfNOndICWMnAHaO4mOI9pP7aQ=";
+    hash = "sha256-j07Uw9MVNUSHw8wwKPal1ENywS4vk/blU11DElhgdFU=";
   };
 
-  vendorSha256 = "sha256-KtBE8zOCSh/sItEpEA+I2cG3U44FJ2wxxVX3F6choUY=";
+  vendorHash = "sha256-Ev0/CSpwJDmc+Dvu/bFDzsgsq80rWImJWXNAUqYHgoE=";
 
   ldflags = [
     "-s"
     "-w"
-    "-X github.com/zricethezav/gitleaks/v${lib.versions.major version}/version.Version=${version}"
+    "-X github.com/zricethezav/gitleaks/v${lib.versions.major version}/cmd.Version=${version}"
+  ];
+
+  nativeBuildInputs = [
+    installShellFiles
   ];
 
   # With v8 the config tests are are blocking
   doCheck = false;
 
+  postInstall = ''
+    installShellCompletion --cmd ${pname} \
+      --bash <($out/bin/${pname} completion bash) \
+      --fish <($out/bin/${pname} completion fish) \
+      --zsh <($out/bin/${pname} completion zsh)
+  '';
+
+  passthru.tests.version = testers.testVersion {
+    package = gitleaks;
+    command = "${pname} version";
+  };
+
   meta = with lib; {
     description = "Scan git repos (or files) for secrets";
     longDescription = ''
@@ -32,6 +51,7 @@ buildGoModule rec {
       API keys and tokens in git repos.
     '';
     homepage = "https://github.com/zricethezav/gitleaks";
+    changelog = "https://github.com/zricethezav/gitleaks/releases/tag/v${version}";
     license = with licenses; [ mit ];
     maintainers = with maintainers; [ fab ];
   };