Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
2
3buildGoModule rec {
4 pname = "konstraint";
5 version = "0.29.0";
6
7 src = fetchFromGitHub {
8 owner = "plexsystems";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-j1pvTA3XrmQTgnyyrTAOmcgIJPBcj54YGCPqBjzNIog=";
12 };
13 vendorHash = "sha256-75XFFJtVhVLpZaPDQghlqols54ZuXzpzUx1dw4vSlRg=";
14
15 # Exclude go within .github folder
16 excludedPackages = ".github";
17
18 nativeBuildInputs = [ installShellFiles ];
19
20 ldflags = [ "-s" "-w" "-X github.com/plexsystems/konstraint/internal/commands.version=${version}" ];
21
22 postInstall = ''
23 installShellCompletion --cmd konstraint \
24 --bash <($out/bin/konstraint completion bash) \
25 --fish <($out/bin/konstraint completion fish) \
26 --zsh <($out/bin/konstraint completion zsh)
27 '';
28
29 doInstallCheck = true;
30 installCheckPhase = ''
31 runHook preInstallCheck
32 $out/bin/konstraint --help
33 $out/bin/konstraint --version | grep "${version}"
34 runHook postInstallCheck
35 '';
36
37 meta = with lib; {
38 homepage = "https://github.com/plexsystems/konstraint";
39 changelog = "https://github.com/plexsystems/konstraint/releases/tag/v${version}";
40 description = "A policy management tool for interacting with Gatekeeper";
41 longDescription = ''
42 konstraint is a CLI tool to assist with the creation and management of templates and constraints when using
43 Gatekeeper. Automatically copy Rego to the ConstraintTemplate. Automatically update all ConstraintTemplates with
44 library changes. Enable writing the same policies for Conftest and Gatekeeper.
45 '';
46 license = licenses.mit;
47 maintainers = with maintainers; [ jk ];
48 };
49}