mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-23 14:13:35 +00:00
65 lines
1.8 KiB
Nix
65 lines
1.8 KiB
Nix
{ lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "conftest";
|
|
version = "0.43.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "open-policy-agent";
|
|
repo = "conftest";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-5eMl6dvEW5CCSIgz/o3T7iwk1EuKMuGMifX8ECHf9Oc=";
|
|
};
|
|
vendorHash = "sha256-pP9Rv23ra3Cv5ZzL8E4/B/T2FQd2vRqIjKmWrINwUjc=";
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X github.com/open-policy-agent/conftest/internal/commands.version=${version}"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
];
|
|
|
|
preCheck = ''
|
|
export HOME="$(mktemp -d)"
|
|
'';
|
|
|
|
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="$(mktemp -d)"
|
|
$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";
|
|
changelog = "https://github.com/open-policy-agent/conftest/releases/tag/v${version}";
|
|
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 ];
|
|
};
|
|
}
|