3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/security/gitleaks/default.nix
superherointj df2d60fec7 gitleaks: 8.11.2 -> 8.12.0
* Fix version.
* Add version test.
* Add shell completion.
2022-09-05 04:18:55 -03:00

56 lines
1.3 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, gitleaks
, installShellFiles
, testers
}:
buildGoModule rec {
pname = "gitleaks";
version = "8.12.0";
src = fetchFromGitHub {
owner = "zricethezav";
repo = pname;
rev = "v${version}";
sha256 = "sha256-g15ySGRX9f3zlmoatfzUomokdXyr33geNZnEQLle9rw=";
};
vendorSha256 = "sha256-Ev0/CSpwJDmc+Dvu/bFDzsgsq80rWImJWXNAUqYHgoE=";
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";
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
};
}