2021-03-25 10:41:51 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, protobuf
|
2021-06-19 08:43:46 +00:00
|
|
|
, git
|
2021-03-25 10:41:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "buf";
|
2021-06-19 08:43:46 +00:00
|
|
|
version = "0.43.2";
|
2021-03-25 10:41:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bufbuild";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-06-19 08:43:46 +00:00
|
|
|
sha256 = "sha256-Go0wLcJrxMgB67WlAI7TwX2UU2sQ/yfmC0h2igOkjc4=";
|
|
|
|
leaveDotGit = true; # Required by TestWorkspaceGit
|
2021-03-25 10:41:51 +00:00
|
|
|
};
|
2021-06-19 08:43:46 +00:00
|
|
|
vendorSha256 = "sha256-HT0dsGniBoQW2Y7MhahDeFvE0nCASoPdzHETju0JuRY=";
|
2021-03-25 10:41:51 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./skip_test_requiring_network.patch
|
|
|
|
];
|
|
|
|
|
2021-06-19 08:43:46 +00:00
|
|
|
nativeBuildInputs = [ protobuf ];
|
|
|
|
checkInputs = [ git ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
|
2021-03-25 10:41:51 +00:00
|
|
|
preCheck = ''
|
|
|
|
export PATH=$PATH:$GOPATH/bin
|
2021-06-19 08:43:46 +00:00
|
|
|
# To skip TestCloneBranchAndRefToBucket
|
|
|
|
export CI=true
|
2021-03-25 10:41:51 +00:00
|
|
|
'';
|
|
|
|
|
2021-06-19 08:43:46 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
dir="$GOPATH/bin"
|
|
|
|
# Only install required binaries, don't install testing binaries
|
|
|
|
for file in \
|
|
|
|
"buf" \
|
|
|
|
"protoc-gen-buf-breaking" \
|
|
|
|
"protoc-gen-buf-lint" \
|
|
|
|
"protoc-gen-buf-check-breaking" \
|
|
|
|
"protoc-gen-buf-check-lint"; do
|
|
|
|
cp "$dir/$file" "$out/bin/"
|
|
|
|
done
|
2021-03-25 10:41:51 +00:00
|
|
|
|
2021-06-19 08:43:46 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2021-03-25 10:41:51 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Create consistent Protobuf APIs that preserve compatibility and comply with design best-practices";
|
|
|
|
homepage = "https://buf.build";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ raboof ];
|
|
|
|
};
|
|
|
|
}
|