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(