From baa3d6f43bd991b83d22cda36a8271f8607b8a3f Mon Sep 17 00:00:00 2001 From: Peter Kolloch Date: Sun, 3 Mar 2019 12:02:26 +0100 Subject: [PATCH] buildRustCrate: Make CARGO_MANIFEST_DIR absolute While it is not obvious from the source, cargo sets CARGO_MANIFEST_DIR to an absolute directory. This let to a build problem with the popular "tera" crate using the "pest" crate. ## Cargo details The variable is set here: https://github.com/rust-lang/cargo/blob/f7c91ba6220e1b96aa14e5964e7074452f9551fb/src/cargo/core/compiler/compilation.rs#L229 and computed from the `manifest_path`: https://github.com/rust-lang/cargo/blob/f7c91ba6220e1b96aa14e5964e7074452f9551fb/src/cargo/core/package.rs#L163 The manifest path is also exported via `cargo metadata` where you can see that it is absolute. --- pkgs/build-support/rust/build-rust-crate/configure-crate.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix index 9f499e4f5e72..b184d363d554 100644 --- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix @@ -81,7 +81,7 @@ in '' export CARGO_CFG_TARGET_POINTER_WIDTH=${toString stdenv.hostPlatform.parsed.cpu.bits} export CARGO_CFG_TARGET_VENDOR=${stdenv.hostPlatform.parsed.vendor.name} - export CARGO_MANIFEST_DIR="." + export CARGO_MANIFEST_DIR=$(pwd) export DEBUG="${toString (!release)}" export OPT_LEVEL="${toString optLevel}" export TARGET="${stdenv.hostPlatform.config}"