mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-24 06:33:42 +00:00
53 lines
1.3 KiB
Nix
53 lines
1.3 KiB
Nix
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, packr, ... }:
|
|
|
|
buildGoModule rec {
|
|
pname = "kubernetes-polaris";
|
|
version = "8.2.4";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "FairwindsOps";
|
|
repo = "polaris";
|
|
rev = version;
|
|
sha256 = "sha256-zKiEgfd/5oSEesXtW9fYUqe4Ixb1elqK9zkwUco4Y8k=";
|
|
};
|
|
|
|
vendorHash = "sha256-OOA6OfBJHBPD890m7orJmSvn3kHW2lk84Q4xml5tUA8=";
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X main.Version=${version}"
|
|
"-X main.Commit=${version}"
|
|
];
|
|
|
|
preBuild = ''
|
|
${packr}/bin/packr2 -v --ignore-imports
|
|
'';
|
|
|
|
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";
|
|
homepage = "https://www.fairwinds.com/polaris";
|
|
license = with licenses; [ asl20 ];
|
|
maintainers = with maintainers; [ longer ];
|
|
};
|
|
}
|