pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / tools / security / gitleaks / default.nix
blobfa17828c303c8b009c7a1236f84a375480c26baf
2   lib,
3   stdenv,
4   buildGoModule,
5   fetchFromGitHub,
6   gitleaks,
7   installShellFiles,
8   testers,
9   nix-update-script,
12 buildGoModule rec {
13   pname = "gitleaks";
14   version = "8.21.2";
16   src = fetchFromGitHub {
17     owner = "zricethezav";
18     repo = "gitleaks";
19     rev = "refs/tags/v${version}";
20     hash = "sha256-1MCSGFpjYD4XdES+kJTz/NTN/B00TWMQ1Rmk/nsKf2Q=";
21   };
23   vendorHash = "sha256-iIgS0fXdiVMYKr3FZTYlCSEqqaH9sxZh1MFry9pGET8=";
25   ldflags = [
26     "-s"
27     "-w"
28     "-X=github.com/zricethezav/gitleaks/v${lib.versions.major version}/cmd.Version=${version}"
29   ];
31   nativeBuildInputs = [ installShellFiles ];
33   # With v8 the config tests are blocking
34   doCheck = false;
36   postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
37     installShellCompletion --cmd ${pname} \
38       --bash <($out/bin/${pname} completion bash) \
39       --fish <($out/bin/${pname} completion fish) \
40       --zsh <($out/bin/${pname} completion zsh)
41   '';
43   passthru.tests.version = testers.testVersion {
44     package = gitleaks;
45     command = "${pname} version";
46   };
48   passthru.updateScript = nix-update-script { };
50   meta = with lib; {
51     description = "Scan git repos (or files) for secrets";
52     longDescription = ''
53       Gitleaks is a SAST tool for detecting hardcoded secrets like passwords,
54       API keys and tokens in git repos.
55     '';
56     homepage = "https://github.com/zricethezav/gitleaks";
57     changelog = "https://github.com/zricethezav/gitleaks/releases/tag/v${version}";
58     license = with licenses; [ mit ];
59     maintainers = with maintainers; [ fab ];
60     mainProgram = "gitleaks";
61   };