diff --git a/pkgs/development/libraries/grpc/default.nix b/pkgs/development/libraries/grpc/default.nix index 2bf843241a6a..62f0c2e3d314 100644 --- a/pkgs/development/libraries/grpc/default.nix +++ b/pkgs/development/libraries/grpc/default.nix @@ -1,4 +1,5 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, zlib, c-ares, pkg-config, re2, openssl, protobuf +{ lib, stdenv, fetchFromGitHub, fetchpatch, buildPackages +, cmake, zlib, c-ares, pkg-config, re2, openssl, protobuf, grpc , abseil-cpp, libnsl }: @@ -20,7 +21,8 @@ stdenv.mkDerivation rec { }) ]; - nativeBuildInputs = [ cmake pkg-config ]; + nativeBuildInputs = [ cmake pkg-config ] + ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) grpc; propagatedBuildInputs = [ c-ares re2 zlib abseil-cpp ]; buildInputs = [ c-ares.cmake-config openssl protobuf ] ++ lib.optionals stdenv.isLinux [ libnsl ]; @@ -35,6 +37,8 @@ stdenv.mkDerivation rec { "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_SKIP_BUILD_RPATH=OFF" "-DCMAKE_CXX_STANDARD=17" + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc" ]; # CMake creates a build directory by default, this conflicts with the