Files
nixpkgs/pkgs/by-name/kd/kdigger/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

81 lines
2.3 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
buildGoModule rec {
pname = "kdigger";
version = "1.5.1";
src = fetchFromGitHub {
owner = "quarkslab";
repo = "kdigger";
tag = "v${version}";
hash = "sha256-hpLhtTENtOBQjm+CZRAcx1BG9831JUFIsLL57wZIrso=";
# populate values that require us to use git. By doing this in postFetch we
# can delete .git afterwards and maintain better reproducibility of the src.
leaveDotGit = true;
postFetch = ''
cd "$out"
git rev-parse HEAD > $out/COMMIT
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
};
vendorHash = "sha256-kMoTkrDuAJmgWAj7+V3a8VEYpPbTv3UdLscTdkpzud0=";
nativeBuildInputs = [ installShellFiles ];
# static to be easily copied into containers since it's an in-pod pen-testing tool
env.CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/quarkslab/kdigger/commands.VERSION=v${version}"
"-X github.com/quarkslab/kdigger/commands.BUILDERARCH=${stdenv.hostPlatform.linuxArch}"
];
preBuild = ''
ldflags+=" -X github.com/quarkslab/kdigger/commands.GITCOMMIT=$(cat COMMIT)"
'';
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd kdigger \
--bash <($out/bin/kdigger completion bash) \
--fish <($out/bin/kdigger completion fish) \
--zsh <($out/bin/kdigger completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/kdigger --help
runHook postInstallCheck
'';
meta = {
homepage = "https://github.com/quarkslab/kdigger";
changelog = "https://github.com/quarkslab/kdigger/releases/tag/v${version}";
description = "In-pod context discovery tool for Kubernetes penetration testing";
mainProgram = "kdigger";
longDescription = ''
kdigger, short for "Kubernetes digger", is a context discovery tool for
Kubernetes penetration testing. This tool is a compilation of various
plugins called buckets to facilitate pentesting Kubernetes from inside a
pod.
'';
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ jk ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
];
};
}