From 122ee75ce30798640240449e3e73c1f9cb2fed2c Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 2 Jan 2025 07:53:55 +0100 Subject: [PATCH] fix: Darwin compat (cherry picked from commit 711d95877a039bcd5b162604a22d1c051b59a49d) --- rust/nci.nix | 8 ++++---- rust/nix-expr/src/eval_state.rs | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rust/nci.nix b/rust/nci.nix index 25c7dfc..79202c3 100644 --- a/rust/nci.nix +++ b/rust/nci.nix @@ -47,10 +47,10 @@ # NOTE: duplicated in flake.nix devShell env = { LIBCLANG_PATH = - if pkgs.stdenv.cc.isClang then - null # don't set the variable - else - lib.makeLibraryPath [ pkgs.buildPackages.llvmPackages.clang-unwrapped ]; + lib.makeLibraryPath [ pkgs.buildPackages.llvmPackages.clang-unwrapped ]; + BINDGEN_EXTRA_CLANG_ARGS = + # Work around missing [[deprecated]] in clang + "-x c++ -std=c++2a"; } // lib.optionalAttrs pkgs.stdenv.cc.isGNU { # Avoid cc wrapper, because we only need to add the compiler/"system" dirs NIX_CC_UNWRAPPED = "${pkgs.stdenv.cc.cc}/bin/gcc"; diff --git a/rust/nix-expr/src/eval_state.rs b/rust/nix-expr/src/eval_state.rs index db7c97e..b631595 100644 --- a/rust/nix-expr/src/eval_state.rs +++ b/rust/nix-expr/src/eval_state.rs @@ -632,7 +632,10 @@ pub fn test_init() { // When testing in the sandbox, the default build dir would be a parent of the storeDir, // which causes an error. So we set a custom build dir here. - nix_util::settings::set("sandbox-build-dir", "/custom-build-dir-for-test").unwrap(); + // Only available on linux + if cfg!(target_os = "linux") { + nix_util::settings::set("sandbox-build-dir", "/custom-build-dir-for-test").unwrap(); + } std::env::set_var("_NIX_TEST_NO_SANDBOX", "1"); // The tests run offline