From 1a604de2e7d722c740ab3b01189889d0e357ac11 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Sat, 14 Aug 2021 10:11:33 +0200 Subject: [PATCH] buf: use testVersion utility `installCheckPhase` is mainly intended for checks that are part of the upstream package, for our 'own' checks we prefer `passthru.tests`. This loses running `buf --help`, but I'm not sure how much that adds on top of `buf --version`? --- pkgs/build-support/trivial-builders.nix | 2 +- pkgs/development/tools/buf/default.nix | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 6f51ba512c12..7d4f18dcc298 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -616,7 +616,7 @@ rec { command ? "${package.meta.mainProgram or package.pname or package.name} --version", version ? package.version, }: runCommand "test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } '' - ${command} | grep -Fw ${version} + ${command} |& grep -Fw ${version} touch $out ''; } diff --git a/pkgs/development/tools/buf/default.nix b/pkgs/development/tools/buf/default.nix index 230f5b09b99f..585791316f8c 100644 --- a/pkgs/development/tools/buf/default.nix +++ b/pkgs/development/tools/buf/default.nix @@ -3,6 +3,8 @@ , fetchFromGitHub , protobuf , git +, testVersion +, buf }: buildGoModule rec { @@ -54,13 +56,7 @@ buildGoModule rec { runHook postInstall ''; - doInstallCheck = true; - installCheckPhase = '' - runHook preInstallCheck - $out/bin/buf --help - $out/bin/buf --version 2>&1 | grep "${version}" - runHook postInstallCheck - ''; + passthru.tests.version = testVersion { package = buf; }; meta = with lib; { homepage = "https://buf.build";