depot/third_party/nixpkgs/pkgs/development/tools/conftest/default.nix
Default email 14910f5943 Project import generated by Copybara.
GitOrigin-RevId: 5aaed40d22f0d9376330b6fa413223435ad6fee5
2022-01-13 15:06:32 -05:00

57 lines
1.7 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "conftest";
version = "0.30.0";
src = fetchFromGitHub {
owner = "open-policy-agent";
repo = "conftest";
rev = "v${version}";
sha256 = "sha256-8/eZz5ejw5bahCYwz825HI+oZ6D1odeTpMIJh0TcGMY=";
};
vendorSha256 = "sha256-rYWo0t6iUI6DVsjHJg2fUv2tv3jovndi12prKzLaMlI=";
ldflags = [
"-s"
"-w"
"-X github.com/open-policy-agent/conftest/internal/commands.version=${version}"
];
nativeBuildInputs = [ installShellFiles ];
preCheck = ''
export HOME="$TMPDIR"
'';
postInstall = ''
installShellCompletion --cmd conftest \
--bash <($out/bin/conftest completion bash) \
--fish <($out/bin/conftest completion fish) \
--zsh <($out/bin/conftest completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
export HOME="$TMPDIR"
$out/bin/conftest --version | grep ${version} > /dev/null
'';
meta = with lib; {
description = "Write tests against structured configuration data";
downloadPage = "https://github.com/open-policy-agent/conftest";
homepage = "https://www.conftest.dev";
license = licenses.asl20;
longDescription = ''
Conftest helps you write tests against structured configuration data.
Using Conftest you can write tests for your Kubernetes configuration,
Tekton pipeline definitions, Terraform code, Serverless configs or any
other config files.
Conftest uses the Rego language from Open Policy Agent for writing the
assertions. You can read more about Rego in 'How do I write policies' in
the Open Policy Agent documentation.
'';
maintainers = with maintainers; [ jk yurrriq ];
};
}