Let's work around it downstream while we wait for a release.

Fixes #56.
This commit is contained in:
Zhaofeng Li 2023-06-12 18:52:16 -06:00
parent 5ca98fbaa8
commit 71a5580d17
2 changed files with 12 additions and 0 deletions

View file

@ -45,6 +45,7 @@ tokio-test = "0.4.2"
[build-dependencies]
cxx-build = { version = "1.0", optional = true }
pkg-config = "0.3.27"
tempfile = "3"
[features]
default = [ "nix_store", "tokio" ]

View file

@ -9,12 +9,23 @@ fn main() {
#[cfg(feature = "nix_store")]
fn build_bridge() {
// Temporary workaround for issue in <https://github.com/NixOS/nix/pull/8484>
let hacky_include = {
let dir = tempfile::tempdir()
.expect("Failed to create temporary directory for workaround");
std::fs::write(dir.path().join("uds-remote-store.md"), "\"\"")
.unwrap();
dir
};
cxx_build::bridge("src/nix_store/bindings/mod.rs")
.file("src/nix_store/bindings/nix.cpp")
.flag("-std=c++17")
.flag("-O2")
.flag("-include")
.flag("nix/config.h")
.flag("-idirafter")
.flag(hacky_include.path().to_str().unwrap())
.compile("nixbinding");
println!("cargo:rerun-if-changed=src/nix_store/bindings");