2021-03-20 04:20:00 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, protobuf
|
2021-06-28 23:13:55 +00:00
|
|
|
, git
|
2021-08-18 13:19:15 +00:00
|
|
|
, testVersion
|
|
|
|
, buf
|
2021-03-20 04:20:00 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "buf";
|
2022-01-03 16:56:52 +00:00
|
|
|
version = "1.0.0-rc10";
|
2021-03-20 04:20:00 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bufbuild";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-01-03 16:56:52 +00:00
|
|
|
sha256 = "sha256-N6BZ6HDDQ0m41BHGdKOONUjdIBDnPJOpN3eJMcsXYi8=";
|
2021-03-20 04:20:00 +00:00
|
|
|
};
|
2022-01-03 16:56:52 +00:00
|
|
|
vendorSha256 = "sha256-VPS5nRsAssgKSQ6DMtB6+MkMrpIY5+JEvOpaMZ3IWV8=";
|
2021-03-20 04:20:00 +00:00
|
|
|
|
|
|
|
patches = [
|
2021-07-14 22:03:04 +00:00
|
|
|
# Skip a test that requires networking to be available to work.
|
2021-03-20 04:20:00 +00:00
|
|
|
./skip_test_requiring_network.patch
|
2021-08-11 14:56:57 +00:00
|
|
|
# Skip TestWorkspaceGit which requires .git and commits.
|
|
|
|
./skip_test_requiring_dotgit.patch
|
2021-03-20 04:20:00 +00:00
|
|
|
];
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
nativeBuildInputs = [ protobuf ];
|
2021-08-11 14:56:57 +00:00
|
|
|
# Required for TestGitCloner
|
2021-06-28 23:13:55 +00:00
|
|
|
checkInputs = [ git ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
preCheck = ''
|
2021-08-11 14:56:57 +00:00
|
|
|
# The tests need access to some of the built utilities
|
|
|
|
export PATH="$PATH:$GOPATH/bin"
|
2021-06-28 23:13:55 +00:00
|
|
|
# To skip TestCloneBranchAndRefToBucket
|
|
|
|
export CI=true
|
2021-03-20 04:20:00 +00:00
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
# Only install required binaries, don't install testing binaries
|
2021-08-11 14:56:57 +00:00
|
|
|
for FILE in \
|
2021-06-28 23:13:55 +00:00
|
|
|
"buf" \
|
|
|
|
"protoc-gen-buf-breaking" \
|
2021-12-06 16:07:01 +00:00
|
|
|
"protoc-gen-buf-lint"; do
|
2021-08-11 14:56:57 +00:00
|
|
|
cp "$GOPATH/bin/$FILE" "$out/bin/"
|
2021-06-28 23:13:55 +00:00
|
|
|
done
|
2021-03-20 04:20:00 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2021-03-20 04:20:00 +00:00
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
passthru.tests.version = testVersion { package = buf; };
|
2021-08-11 14:56:57 +00:00
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://buf.build";
|
2021-08-11 14:56:57 +00: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-20 04:20:00 +00:00
|
|
|
license = licenses.asl20;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ raboof jk lrewega ];
|
2021-03-20 04:20:00 +00:00
|
|
|
};
|
|
|
|
}
|