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

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

56 lines
1.3 KiB
Nix
Raw Normal View History

2021-03-01 23:30:56 +01:00
{ lib
, buildGoModule
2021-01-19 21:56:03 +01:00
, fetchFromGitHub
, gitleaks
, installShellFiles
, testers
2021-01-19 21:56:03 +01:00
}:
buildGoModule rec {
pname = "gitleaks";
2022-10-14 19:59:57 +02:00
version = "8.15.0";
2021-01-19 21:56:03 +01:00
src = fetchFromGitHub {
owner = "zricethezav";
repo = pname;
rev = "v${version}";
2022-10-14 19:59:57 +02:00
sha256 = "sha256-KqShYaUODClKkbLs3jaj55WXy9HyyBzvY5KdNOqEXPE=";
2021-01-19 21:56:03 +01:00
};
vendorSha256 = "sha256-Ev0/CSpwJDmc+Dvu/bFDzsgsq80rWImJWXNAUqYHgoE=";
2021-01-19 21:56:03 +01:00
2021-08-21 10:23:50 +02:00
ldflags = [
2021-12-19 18:54:19 +01:00
"-s"
"-w"
"-X github.com/zricethezav/gitleaks/v${lib.versions.major version}/cmd.Version=${version}"
2021-08-21 10:23:50 +02:00
];
nativeBuildInputs = [ installShellFiles ];
2021-12-19 18:54:19 +01: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 21:56:03 +01: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 18:54:19 +01:00
API keys and tokens in git repos.
2021-01-19 21:56:03 +01:00
'';
homepage = "https://github.com/zricethezav/gitleaks";
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
};
}