nixpkgs/pkgs/development/tools/buf/default.nix

67 lines
1.6 KiB
Nix
Raw Normal View History

2021-03-25 11:41:51 +01:00
{ lib
, buildGoModule
, fetchFromGitHub
, protobuf
, git
, 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 = [
# Skip a test that requires networking to be available to work.
2021-03-25 11:41:51 +01:00
./skip_test_requiring_network.patch
# Skip TestWorkspaceGit which requires .git and commits.
./skip_test_requiring_dotgit.patch
2021-03-25 11:41:51 +01:00
];
nativeBuildInputs = [ protobuf ];
# Required for TestGitCloner
checkInputs = [ git ];
ldflags = [ "-s" "-w" ];
2021-03-25 11:41:51 +01:00
preCheck = ''
# The tests need access to some of the built utilities
export PATH="$PATH:$GOPATH/bin"
# To skip TestCloneBranchAndRefToBucket
export CI=true
2021-03-25 11:41:51 +01:00
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/bin"
# Only install required binaries, don't install testing binaries
for FILE in \
"buf" \
"protoc-gen-buf-breaking" \
2021-10-13 20:04:06 +02:00
"protoc-gen-buf-lint"; do
cp "$GOPATH/bin/$FILE" "$out/bin/"
done
2021-03-25 11:41:51 +01:00
runHook postInstall
'';
2021-03-25 11:41:51 +01:00
passthru.tests.version = testVersion { package = buf; };
2021-03-25 11:41:51 +01:00
meta = with lib; {
homepage = "https://buf.build";
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
};
}