depot/third_party/nixpkgs/pkgs/tools/security/gitleaks/default.nix
Default email 5e7c2d6cef Project import generated by Copybara.
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
2023-10-09 21:29:22 +02:00

58 lines
1.4 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, gitleaks
, installShellFiles
, testers
}:
buildGoModule rec {
pname = "gitleaks";
version = "8.18.0";
src = fetchFromGitHub {
owner = "zricethezav";
repo = pname;
rev = "v${version}";
hash = "sha256-659wQBv8DuYB4vI+qnBLS9u22kGlg4ne4DyKFoomlOw=";
};
vendorHash = "sha256-PPEEQ2Bt20UK+mQL59jVnX8HtzCsqW4uRwR3mOdhDis=";
ldflags = [
"-s"
"-w"
"-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 = ''
Gitleaks is a SAST tool for detecting hardcoded secrets like passwords,
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 ];
};
}