depot/third_party/nixpkgs/pkgs/tools/security/gitleaks/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

58 lines
1.5 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
gitleaks,
installShellFiles,
testers,
}:
buildGoModule rec {
pname = "gitleaks";
version = "8.18.4";
src = fetchFromGitHub {
owner = "zricethezav";
repo = "gitleaks";
rev = "refs/tags/v${version}";
hash = "sha256-tAomF5Ym+D/VMYXrsPlUnh3M94Xdx6I8WoU1jMouZag=";
};
vendorHash = "sha256-DgCtWRo5KNuFCdhGJvzoH2v8n7mIxNk8eHyZFPUPo24=";
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 ];
mainProgram = "gitleaks";
};
}