open-policy-agent: cleanup

This commit is contained in:
Gaetan Lepage
2025-04-18 16:59:45 +02:00
parent dadb234094
commit 3baf3c4c6a
+14 -14
View File
@@ -12,14 +12,14 @@ assert
enableWasmEval && stdenv.hostPlatform.isDarwin
-> builtins.throw "building with wasm on darwin is failing in nixpkgs";
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "open-policy-agent";
version = "1.3.0";
src = fetchFromGitHub {
owner = "open-policy-agent";
repo = "opa";
rev = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-wWxWpJSDOaZLJ7ULdAzPFJ9YNXX3FyQRod2roaLsuis=";
};
@@ -32,7 +32,7 @@ buildGoModule rec {
ldflags = [
"-s"
"-w"
"-X github.com/open-policy-agent/opa/version.Version=${version}"
"-X github.com/open-policy-agent/opa/version.Version=${finalAttrs.version}"
];
tags = lib.optional enableWasmEval (
@@ -63,17 +63,17 @@ buildGoModule rec {
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
preCheck =
# Feed in all but the e2e tests for testing
# This is because subPackages above limits what is built to just what we
# want but also limits the tests
# Also avoid wasm tests on darwin due to wasmtime-go build issues
''
# Feed in all but the e2e tests for testing
# This is because subPackages above limits what is built to just what we
# want but also limits the tests
# Also avoid wasm tests on darwin due to wasmtime-go build issues
getGoDirs() {
go list ./... | grep -v -e e2e ${lib.optionalString stdenv.hostPlatform.isDarwin "-e wasm"}
}
''
# remove tests that have "too many open files"/"no space left on device" issues on darwin in hydra
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# remove tests that have "too many open files"/"no space left on device" issues on darwin in hydra
rm v1/server/server_test.go
'';
@@ -89,7 +89,7 @@ buildGoModule rec {
runHook preInstallCheck
$out/bin/opa --help
$out/bin/opa version | grep "Version: ${version}"
$out/bin/opa version | grep "Version: ${finalAttrs.version}"
${lib.optionalString enableWasmEval ''
# If wasm is enabled verify it works
@@ -102,10 +102,10 @@ buildGoModule rec {
# Required for tests that need networking
__darwinAllowLocalNetworking = true;
meta = with lib; {
meta = {
mainProgram = "opa";
homepage = "https://www.openpolicyagent.org";
changelog = "https://github.com/open-policy-agent/opa/blob/v${version}/CHANGELOG.md";
changelog = "https://github.com/open-policy-agent/opa/blob/v${finalAttrs.version}/CHANGELOG.md";
description = "General-purpose policy engine";
longDescription = ''
The Open Policy Agent (OPA, pronounced "oh-pa") is an open source, general-purpose policy engine that unifies
@@ -113,10 +113,10 @@ buildGoModule rec {
as code and simple APIs to offload policy decision-making from your software. You can use OPA to enforce policies
in microservices, Kubernetes, CI/CD pipelines, API gateways, and more.
'';
license = licenses.asl20;
maintainers = with maintainers; [
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
lewo
jk
];
};
}
})