git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commitbaa3d6f43bd991b83d22cda36a8271f8607b8a3f authorPeter Kolloch <info@eigenvalue.net> dateSun 3 Mar 2019, 12:02 (8 years ago) parent93ce3df
1 file changed+1−1
pkgs/build-support/rust/build-rust-crate/configure-crate.nix+1−1
pkgs/build-support/rust/build-rust-crate/configure-crate.nix+1−1
@@ -81,7 +81,7 @@ in ''
8181 export CARGO_CFG_TARGET_POINTER_WIDTH=${toString stdenv.hostPlatform.parsed.cpu.bits}
8282 export CARGO_CFG_TARGET_VENDOR=${stdenv.hostPlatform.parsed.vendor.name}
8383
84− export CARGO_MANIFEST_DIR="."
84+ export CARGO_MANIFEST_DIR=$(pwd)
8585 export DEBUG="${toString (!release)}"
8686 export OPT_LEVEL="${toString optLevel}"
8787 export TARGET="${stdenv.hostPlatform.config}"