2021-03-25 11:41:51 +01:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, protobuf
|
2021-06-19 10:43:46 +02:00
|
|
|
, git
|
2021-08-14 10:11:33 +02:00
|
|
|
, testVersion
|
|
|
|
, buf
|
2021-03-25 11:41:51 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "buf";
|
2021-11-11 20:30:48 +01:00
|
|
|
version = "1.0.0-rc8";
|
2021-03-25 11:41:51 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bufbuild";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-11-11 20:30:48 +01:00
|
|
|
sha256 = "sha256-Oye+nYvKdT9t36hAMJSAJZCOQ2L3rHSjhjIu9gU2MWo=";
|
2021-03-25 11:41:51 +01:00
|
|
|
};
|
2021-11-11 20:30:48 +01:00
|
|
|
vendorSha256 = "sha256-aZv44ZPW/bJ8TEXU79ExREj2DH6j7J1+E/E1yh13Hvc=";
|
2021-03-25 11:41:51 +01:00
|
|
|
|
|
|
|
patches = [
|
2021-07-13 17:06:06 +02:00
|
|
|
# Skip a test that requires networking to be available to work.
|
2021-03-25 11:41:51 +01:00
|
|
|
./skip_test_requiring_network.patch
|
2021-08-11 11:29:52 +02:00
|
|
|
# Skip TestWorkspaceGit which requires .git and commits.
|
|
|
|
./skip_test_requiring_dotgit.patch
|
2021-03-25 11:41:51 +01:00
|
|
|
];
|
|
|
|
|
2021-06-19 10:43:46 +02:00
|
|
|
nativeBuildInputs = [ protobuf ];
|
2021-08-11 11:29:52 +02:00
|
|
|
# Required for TestGitCloner
|
2021-06-19 10:43:46 +02:00
|
|
|
checkInputs = [ git ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
|
2021-03-25 11:41:51 +01:00
|
|
|
preCheck = ''
|
2021-08-11 11:29:52 +02:00
|
|
|
# The tests need access to some of the built utilities
|
|
|
|
export PATH="$PATH:$GOPATH/bin"
|
2021-06-19 10:43:46 +02:00
|
|
|
# To skip TestCloneBranchAndRefToBucket
|
|
|
|
export CI=true
|
2021-03-25 11:41:51 +01:00
|
|
|
'';
|
|
|
|
|
2021-06-19 10:43:46 +02:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
# Only install required binaries, don't install testing binaries
|
2021-08-11 11:29:52 +02:00
|
|
|
for FILE in \
|
2021-06-19 10:43:46 +02:00
|
|
|
"buf" \
|
|
|
|
"protoc-gen-buf-breaking" \
|
2021-10-13 20:04:06 +02:00
|
|
|
"protoc-gen-buf-lint"; do
|
2021-08-11 11:29:52 +02:00
|
|
|
cp "$GOPATH/bin/$FILE" "$out/bin/"
|
2021-06-19 10:43:46 +02:00
|
|
|
done
|
2021-03-25 11:41:51 +01:00
|
|
|
|
2021-06-19 10:43:46 +02:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2021-03-25 11:41:51 +01:00
|
|
|
|
2021-08-14 10:11:33 +02:00
|
|
|
passthru.tests.version = testVersion { package = buf; };
|
2021-08-11 11:29:52 +02:00
|
|
|
|
2021-03-25 11:41:51 +01:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://buf.build";
|
2021-08-11 11:29:52 +02:00
|
|
|
changelog = "https://github.com/bufbuild/buf/releases/tag/v${version}";
|
|
|
|
description = "Create consistent Protobuf APIs that preserve compatibility and comply with design best-practices";
|
2021-03-25 11:41:51 +01:00
|
|
|
license = licenses.asl20;
|
2021-10-13 20:04:06 +02:00
|
|
|
maintainers = with maintainers; [ raboof jk lrewega ];
|
2021-03-25 11:41:51 +01:00
|
|
|
};
|
|
|
|
}
|