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`?
This commit is contained in:
Arnout Engelen 2021-08-14 10:11:33 +02:00
parent 4138cbd913
commit 1a604de2e7
No known key found for this signature in database
GPG Key ID: 061107B0F74A6DAA
2 changed files with 4 additions and 8 deletions

View File

@ -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
'';
}

View File

@ -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";