From b7945f1d0baa5de760108ab6acd27b2d64408c86 Mon Sep 17 00:00:00 2001 From: Ethan Carter Edwards Date: Wed, 28 Oct 2026 23:05:53 -0400 Subject: [PATCH] oasdiff: modernize Signed-off-by: Ethan Carter Edwards --- pkgs/by-name/oa/oasdiff/package.nix | 34 ++++++++++------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/pkgs/by-name/oa/oasdiff/package.nix b/pkgs/by-name/oa/oasdiff/package.nix index a7daa48c5449a..6b5e4d8851be5 100644 --- a/pkgs/by-name/oa/oasdiff/package.nix +++ b/pkgs/by-name/oa/oasdiff/package.nix @@ -7,14 +7,14 @@ makeWrapper, nix-update-script, stdenv, - testers, + versionCheckHook, }: buildGoModule (finalAttrs: { pname = "oasdiff"; version = "1.35.0"; - strictDeps = true; + __darwinAllowLocalNetworking = true; __structuredAttrs = true; src = fetchFromGitHub { @@ -27,11 +27,14 @@ buildGoModule (finalAttrs: { vendorHash = "sha256-ShHiN3pmMwZTc9Ai51CwWSXOKkxuUugbR9KOYZd4JIo="; subPackages = [ "." ]; - env.CGO_ENABLED = 0; + + env = { + CGO_ENABLED = 0; + GOFLAGS = "-trimpath"; + }; ldflags = [ "-s" - "-w" "-X github.com/oasdiff/oasdiff/build.Version=${finalAttrs.version}" ]; @@ -41,19 +44,6 @@ buildGoModule (finalAttrs: { ]; nativeCheckInputs = [ gitMinimal ]; - # The test suite starts local HTTP servers. - __darwinAllowLocalNetworking = true; - - # subPackages selects only the executable, but tests live throughout the module. - checkPhase = '' - runHook preCheck - - export GOFLAGS=''${GOFLAGS//-trimpath/} - go test -p "$NIX_BUILD_CORES" ./... - - runHook postCheck - ''; - postInstall = '' wrapProgram $out/bin/oasdiff \ --prefix PATH : ${lib.makeBinPath [ gitMinimal ]} @@ -65,12 +55,10 @@ buildGoModule (finalAttrs: { --zsh <($out/bin/oasdiff completion zsh) ''; - passthru = { - updateScript = nix-update-script { }; - tests.version = testers.testVersion { - package = finalAttrs.finalPackage; - }; - }; + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + + passthru.updateScript = nix-update-script { }; meta = { description = "Find breaking changes in OpenAPI specifications";