2021-05-03 20:48:10 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2022-07-14 12:49:19 +00:00
|
|
|
, installShellFiles
|
2021-05-03 20:48:10 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "kubesec";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "2.14.1";
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "controlplaneio";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
sha256 = "sha256-FYYMCouZuG0EqvganPLSrLgaDZ+JowUcYXTnKMJ+6Us=";
|
2021-05-03 20:48:10 +00:00
|
|
|
};
|
2024-09-19 14:19:46 +00:00
|
|
|
vendorHash = "sha256-KTmsCbFRHMd1KnBYxwWWuETaTP0G3NYCK/ttgrFy59I=";
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/controlplaneio/kubesec/v${lib.versions.major version}/cmd.version=v${version}"
|
|
|
|
];
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
# Tests wants to download the kubernetes schema for use with kubeval
|
2021-05-03 20:48:10 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd kubesec \
|
|
|
|
--bash <($out/bin/kubesec completion bash) \
|
|
|
|
--fish <($out/bin/kubesec completion fish) \
|
|
|
|
--zsh <($out/bin/kubesec completion zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
$out/bin/kubesec --help
|
|
|
|
$out/bin/kubesec version | grep "${version}"
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Security risk analysis tool for Kubernetes resources";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "kubesec";
|
2021-05-03 20:48:10 +00:00
|
|
|
homepage = "https://github.com/controlplaneio/kubesec";
|
2021-06-28 23:13:55 +00:00
|
|
|
changelog = "https://github.com/controlplaneio/kubesec/blob/v${version}/CHANGELOG.md";
|
2021-05-03 20:48:10 +00:00
|
|
|
license = with licenses; [ asl20 ];
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ fab jk ];
|
2021-05-03 20:48:10 +00:00
|
|
|
};
|
|
|
|
}
|