From 92a7cc86a694e9e1652d59d3d9eee006f0d65fca Mon Sep 17 00:00:00 2001 From: Amanjeev Sethi Date: Mon, 31 Aug 2020 13:05:53 -0400 Subject: [PATCH] tonic-build: (docs) adds NixOS related hints (#444) --- tonic-build/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tonic-build/src/lib.rs b/tonic-build/src/lib.rs index 6b02836..8b9b0af 100644 --- a/tonic-build/src/lib.rs +++ b/tonic-build/src/lib.rs @@ -40,7 +40,22 @@ //! )?; //! Ok(()) //! } +//!``` +//! +//! ## NixOS related hints +//! +//! On NixOS, it is better to specify the location of `PROTOC` and `PROTOC_INCLUDE` explicitly. +//! +//! ```bash +//! $ export PROTOBUF_LOCATION=$(nix-env -q protobuf --out-path --no-name) +//! $ export PROTOC=$PROTOBUF_LOCATION/bin/protoc +//! $ export PROTOC_INCLUDE=$PROTOBUF_LOCATION/include +//! $ cargo build //! ``` +//! +//! The reason being that if `prost_build::compile_protos` fails to generate the resultant package, +//! the failure is not obvious until the `include!(concat!(env!("OUT_DIR"), "/resultant.rs"));` +//! fails with `No such file or directory` error. #![recursion_limit = "256"] #![warn(