nixpkgs/pkgs/by-name/gi/gitleaks/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

63 lines
1.6 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
gitleaks,
installShellFiles,
testers,
nix-update-script,
}:
buildGoModule rec {
pname = "gitleaks";
version = "8.21.2";
src = fetchFromGitHub {
owner = "zricethezav";
repo = "gitleaks";
rev = "refs/tags/v${version}";
hash = "sha256-1MCSGFpjYD4XdES+kJTz/NTN/B00TWMQ1Rmk/nsKf2Q=";
};
vendorHash = "sha256-iIgS0fXdiVMYKr3FZTYlCSEqqaH9sxZh1MFry9pGET8=";
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";
};
}