2022-04-15 01:41:22 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
2021-08-22 07:53:02 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "konstraint";
|
2022-04-15 01:41:22 +00:00
|
|
|
version = "0.19.0";
|
2021-08-22 07:53:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "plexsystems";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-04-15 01:41:22 +00:00
|
|
|
sha256 = "sha256-BoH/lT+kYiwOtW82mmhhLZY3Xk2pRZHmNrEKJzPiG54=";
|
2021-08-22 07:53:02 +00:00
|
|
|
};
|
2022-04-15 01:41:22 +00:00
|
|
|
vendorSha256 = "sha256-G6WigkkKZj/k+kYlKItSfnoXN8UZ60lFEkZcQaI9J5c=";
|
2021-08-22 07:53:02 +00:00
|
|
|
|
|
|
|
# Exclude go within .github folder
|
|
|
|
excludedPackages = ".github";
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
ldflags = [ "-s" "-w" "-X github.com/plexsystems/konstraint/internal/commands.version=${version}" ];
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd konstraint \
|
|
|
|
--bash <($out/bin/konstraint completion bash) \
|
|
|
|
--fish <($out/bin/konstraint completion fish) \
|
|
|
|
--zsh <($out/bin/konstraint completion zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
$out/bin/konstraint --help
|
|
|
|
$out/bin/konstraint --version | grep "${version}"
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/plexsystems/konstraint";
|
|
|
|
changelog = "https://github.com/plexsystems/konstraint/releases/tag/v${version}";
|
|
|
|
description = "A policy management tool for interacting with Gatekeeper";
|
|
|
|
longDescription = ''
|
|
|
|
konstraint is a CLI tool to assist with the creation and management of templates and constraints when using
|
|
|
|
Gatekeeper. Automatically copy Rego to the ConstraintTemplate. Automatically update all ConstraintTemplates with
|
|
|
|
library changes. Enable writing the same policies for Conftest and Gatekeeper.
|
|
|
|
'';
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ jk ];
|
|
|
|
};
|
|
|
|
}
|