From 3baf3c4c6a519679ee266b4496ac4e2e1819e296 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 18 Apr 2025 14:13:03 +0200 Subject: [PATCH] open-policy-agent: cleanup --- pkgs/by-name/op/open-policy-agent/package.nix | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/op/open-policy-agent/package.nix b/pkgs/by-name/op/open-policy-agent/package.nix index bfc77844fe82..9588f7ee91ea 100644 --- a/pkgs/by-name/op/open-policy-agent/package.nix +++ b/pkgs/by-name/op/open-policy-agent/package.nix @@ -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 ]; }; -} +})