From 50020d0ea8f78e9136e4e271703f4fad7a701ec1 Mon Sep 17 00:00:00 2001 From: foldu Date: Sun, 16 Feb 2020 20:50:39 +0100 Subject: [PATCH] nix stuff --- .envrc | 1 + shell.nix | 9 +++++++++ tgcd/Cargo.toml | 1 - tgcd/build.rs | 6 ++++-- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..be81fed --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +eval "$(lorri direnv)" \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..656805d --- /dev/null +++ b/shell.nix @@ -0,0 +1,9 @@ +let + pkgs = import {}; +in +pkgs.mkShell { + buildInputs = with pkgs; [ + protobuf + ]; + PROTOC = "${pkgs.protobuf}/bin/protoc"; +} diff --git a/tgcd/Cargo.toml b/tgcd/Cargo.toml index 53f61eb..e062e25 100644 --- a/tgcd/Cargo.toml +++ b/tgcd/Cargo.toml @@ -20,4 +20,3 @@ tonic = "0.1.0" [build-dependencies] tonic-build = "0.1.0" -which = "3.1.0" diff --git a/tgcd/build.rs b/tgcd/build.rs index 171a92e..2683aee 100644 --- a/tgcd/build.rs +++ b/tgcd/build.rs @@ -1,6 +1,8 @@ fn main() -> Result<(), Box> { - let protoc = which::which("protoc").map_err(|e| format!("`protoc` not found, please install it: {}", e))?; - std::env::set_var("PROTOC", &protoc); + // force local protoc + // this doesn't work + //let protoc = which::which("protoc").map_err(|e| format!("`protoc` not found, please install it: {}", e))?; + //std::env::set_var("PROTOC", &protoc); tonic_build::compile_protos("proto/tgcd.proto")?; Ok(()) }