nixpkgs/pkgs/tools/security/kube-bench/default.nix

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

50 lines
1.4 KiB
Nix
Raw Normal View History

2022-07-06 15:42:05 +02:00
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "kube-bench";
2023-08-10 04:39:23 +02:00
version = "0.6.17";
2022-07-06 15:42:05 +02:00
src = fetchFromGitHub {
owner = "aquasecurity";
repo = pname;
2023-02-26 19:19:05 +01:00
rev = "refs/tags/v${version}";
2023-08-10 04:39:23 +02:00
hash = "sha256-9pXW8PVJhaYi9uKArIJcXbQ6FbCjFA4z9f5M3DLKnng=";
2022-07-06 15:42:05 +02:00
};
2023-02-26 19:19:05 +01:00
2023-06-23 11:50:16 +02:00
vendorHash = "sha256-dBN6Yi8HtS9LzXr08jhw1hqDwS8a4UqrYaRpM+RzvVM=";
2022-07-06 15:42:05 +02:00
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-s"
"-w"
"-X github.com/aquasecurity/kube-bench/cmd.KubeBenchVersion=v${version}"
];
postInstall = ''
mkdir -p $out/share/kube-bench/
mv ./cfg $out/share/kube-bench/
installShellCompletion --cmd kube-bench \
--bash <($out/bin/kube-bench completion bash) \
--fish <($out/bin/kube-bench completion fish) \
--zsh <($out/bin/kube-bench completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/kube-bench --help
$out/bin/kube-bench version | grep "v${version}"
runHook postInstallCheck
'';
meta = with lib; {
homepage = "https://github.com/aquasecurity/kube-bench";
changelog = "https://github.com/aquasecurity/kube-bench/releases/tag/v${version}";
description = "Checks whether Kubernetes is deployed according to security best practices as defined in the CIS Kubernetes Benchmark";
license = licenses.asl20;
maintainers = with maintainers; [ jk ];
};
}