nixpkgs/pkgs/development/tools/protoc-gen-grpc-web/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.4 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, protobuf
, isStatic ? stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation (finalAttrs: {
2021-08-02 07:58:09 +00:00
pname = "protoc-gen-grpc-web";
version = "1.4.2";
2021-08-02 07:58:09 +00:00
src = fetchFromGitHub {
owner = "grpc";
repo = "grpc-web";
rev = finalAttrs.version;
sha256 = "sha256-OetDAZ6zC8r7e82FILpQQnM+JHG9eludwhEuPaklrnw=";
2021-08-02 07:58:09 +00:00
};
2021-10-25 09:57:38 +00:00
sourceRoot = "source/javascript/net/grpc/web/generator";
2021-08-02 07:58:09 +00:00
enableParallelBuilding = true;
2021-08-02 07:58:09 +00:00
strictDeps = true;
nativeBuildInputs = [ protobuf ];
buildInputs = [ protobuf ];
makeFlags = [
"PREFIX=$(out)"
"STATIC=${if isStatic then "yes" else "no"}"
2022-02-25 15:25:12 +00:00
];
2021-08-02 07:58:09 +00:00
2021-10-25 09:57:38 +00:00
doCheck = true;
nativeCheckInputs = [ protobuf ];
2021-10-25 09:57:38 +00:00
checkPhase = ''
runHook preCheck
CHECK_TMPDIR="$TMPDIR/proto"
mkdir -p "$CHECK_TMPDIR"
protoc \
--proto_path="$src/packages/grpc-web/test/protos" \
2021-10-25 09:57:38 +00:00
--plugin="./protoc-gen-grpc-web" \
--grpc-web_out="import_style=commonjs,mode=grpcwebtext:$CHECK_TMPDIR" \
echo.proto
# check for grpc-web generated file
[ -f "$CHECK_TMPDIR/echo_grpc_web_pb.js" ]
runHook postCheck
'';
2021-08-02 07:58:09 +00:00
meta = with lib; {
homepage = "https://github.com/grpc/grpc-web";
changelog = "https://github.com/grpc/grpc-web/blob/${finalAttrs.version}/CHANGELOG.md";
2021-08-02 07:58:09 +00:00
description = "gRPC web support for Google's protocol buffers";
license = licenses.asl20;
maintainers = with maintainers; [ jk ];
2021-10-25 09:57:38 +00:00
platforms = platforms.unix;
2021-08-02 07:58:09 +00:00
};
})