{ lib, stdenv, buildGoModule, fetchFromGitHub, installShellFiles, }: buildGoModule rec { pname = "gatekeeper"; version = "3.20.1"; src = fetchFromGitHub { owner = "open-policy-agent"; repo = "gatekeeper"; tag = "v${version}"; hash = "sha256-vChpVCw2La4cgNMDFnC7thU4jSmJ4LlOLVVeURNQ1+0="; }; vendorHash = null; nativeBuildInputs = [ installShellFiles ]; ldflags = [ "-X github.com/open-policy-agent/gatekeeper/v3/pkg/version.Version=${version}" ]; subPackages = [ "cmd/gator" ]; postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd gator \ --bash <($out/bin/gator completion bash) \ --fish <($out/bin/gator completion fish) \ --zsh <($out/bin/gator completion zsh) ''; meta = with lib; { description = "Policy Controller for Kubernetes"; mainProgram = "gator"; homepage = "https://github.com/open-policy-agent/gatekeeper"; license = licenses.asl20; maintainers = with maintainers; [ SuperSandro2000 ]; }; }