depot/third_party/nixpkgs/pkgs/tools/security/gitleaks/default.nix
Default email 24fdeddc0a Project import generated by Copybara.
GitOrigin-RevId: 2768c7d042a37de65bb1b5b3268fc987e534c49d
2024-10-23 09:41:50 +03:00

62 lines
1.6 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
gitleaks,
installShellFiles,
testers,
nix-update-script,
}:
buildGoModule rec {
pname = "gitleaks";
version = "8.21.0";
src = fetchFromGitHub {
owner = "zricethezav";
repo = "gitleaks";
rev = "refs/tags/v${version}";
hash = "sha256-oBX9V7OQ+t1hBLsYvX3u5BY8VSj2YGNJ/6qdJH6BVhg=";
};
vendorHash = "sha256-BxuqNe021wfvFHpTRQtDImallBg2PcIX5qM7aLB+uH0=";
ldflags = [
"-s"
"-w"
"-X=github.com/zricethezav/gitleaks/v${lib.versions.major version}/cmd.Version=${version}"
];
nativeBuildInputs = [ installShellFiles ];
# With v8 the config tests are blocking
doCheck = false;
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
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";
};
passthru.updateScript = nix-update-script { };
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";
};
}