depot/third_party/nixpkgs/pkgs/tools/security/kubernetes-polaris/default.nix
Default email 7e47f3658e Project import generated by Copybara.
GitOrigin-RevId: 1925c603f17fc89f4c8f6bf6f631a802ad85d784
2024-09-26 11:04:55 +00:00

49 lines
1.2 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "kubernetes-polaris";
version = "9.4.0";
src = fetchFromGitHub {
owner = "FairwindsOps";
repo = "polaris";
rev = version;
sha256 = "sha256-Vw+4/GVuTM4KioZnFk2RH6rmXD6zQO29NepAr2TwHjI=";
};
vendorHash = "sha256-X0GPKR6l1v5312hOmelrcqp4KT3LwsGkvKoqUfEM0uU=";
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-s"
"-w"
"-X main.Version=${version}"
"-X main.Commit=${version}"
];
postInstall = ''
installShellCompletion --cmd polaris \
--bash <($out/bin/polaris completion bash) \
--fish <($out/bin/polaris completion fish) \
--zsh <($out/bin/polaris completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/polaris help
$out/bin/polaris version | grep 'Polaris version:${version}'
runHook postInstallCheck
'';
meta = with lib; {
description = "Validate and remediate Kubernetes resources to ensure configuration best practices are followed";
mainProgram = "polaris";
homepage = "https://www.fairwinds.com/polaris";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ longer ];
};
}