nixpkgs/pkgs/tools/security/gitleaks/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.4 KiB
Nix
Raw Normal View History

2021-03-01 22:30:56 +00:00
{ lib
, buildGoModule
2021-01-19 20:56:03 +00:00
, fetchFromGitHub
, gitleaks
, installShellFiles
, testers
2021-01-19 20:56:03 +00:00
}:
buildGoModule rec {
pname = "gitleaks";
version = "8.16.3";
2021-01-19 20:56:03 +00:00
src = fetchFromGitHub {
owner = "zricethezav";
repo = pname;
rev = "v${version}";
hash = "sha256-WukTYi7iqagOLpx8KATEittlM6OvIfxDYiNTdsotjTY=";
2021-01-19 20:56:03 +00:00
};
2022-12-02 16:13:58 +00:00
vendorHash = "sha256-Ev0/CSpwJDmc+Dvu/bFDzsgsq80rWImJWXNAUqYHgoE=";
2021-01-19 20:56:03 +00:00
2021-08-21 08:23:50 +00:00
ldflags = [
2021-12-19 17:54:19 +00:00
"-s"
"-w"
"-X github.com/zricethezav/gitleaks/v${lib.versions.major version}/cmd.Version=${version}"
2021-08-21 08:23:50 +00:00
];
2022-12-02 16:13:58 +00:00
nativeBuildInputs = [
installShellFiles
];
2021-12-19 17:54:19 +00:00
# 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";
};
2021-01-19 20:56:03 +00:00
meta = with lib; {
description = "Scan git repos (or files) for secrets";
longDescription = ''
Gitleaks is a SAST tool for detecting hardcoded secrets like passwords,
2021-12-19 17:54:19 +00:00
API keys and tokens in git repos.
2021-01-19 20:56:03 +00:00
'';
homepage = "https://github.com/zricethezav/gitleaks";
2022-12-02 16:13:58 +00:00
changelog = "https://github.com/zricethezav/gitleaks/releases/tag/v${version}";
2021-01-19 20:56:03 +00:00
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
};
}