diff --git a/pkgs/development/tools/rust/bindgen/default.nix b/pkgs/development/tools/rust/bindgen/default.nix index b574eb546421..734d31aba2d3 100644 --- a/pkgs/development/tools/rust/bindgen/default.nix +++ b/pkgs/development/tools/rust/bindgen/default.nix @@ -1,5 +1,4 @@ { - lib, rust-bindgen-unwrapped, zlib, bash, @@ -14,7 +13,6 @@ let #for substituteAll inherit bash; unwrapped = rust-bindgen-unwrapped; - libclang = (lib.getLib clang.cc); meta = rust-bindgen-unwrapped.meta // { longDescription = rust-bindgen-unwrapped.meta.longDescription + '' This version of bindgen is wrapped with the required compiler flags diff --git a/pkgs/development/tools/rust/bindgen/unwrapped.nix b/pkgs/development/tools/rust/bindgen/unwrapped.nix index c569789143d5..39b4de40b83b 100644 --- a/pkgs/development/tools/rust/bindgen/unwrapped.nix +++ b/pkgs/development/tools/rust/bindgen/unwrapped.nix @@ -21,12 +21,16 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-K/iM79RfNU+3f2ae6wy/FMFAD68vfqzSUebqALPJpJY="; - buildInputs = [ (lib.getLib clang.cc) ]; - preConfigure = '' export LIBCLANG_PATH="${lib.getLib clang.cc}/lib" ''; + # Disable the "runtime" feature, so libclang is linked. + buildNoDefaultFeatures = true; + buildFeatures = [ "logging" ]; + checkNoDefaultFeatures = buildNoDefaultFeatures; + checkFeatures = buildFeatures; + doCheck = true; nativeCheckInputs = [ clang ]; diff --git a/pkgs/development/tools/rust/bindgen/wrapper.sh b/pkgs/development/tools/rust/bindgen/wrapper.sh index b7110385c26d..4311b9720aa8 100755 --- a/pkgs/development/tools/rust/bindgen/wrapper.sh +++ b/pkgs/development/tools/rust/bindgen/wrapper.sh @@ -27,10 +27,8 @@ fi; if [[ -n "$NIX_DEBUG" ]]; then set -x; fi; -export LIBCLANG_PATH="@libclang@/lib" # shellcheck disable=SC2086 # cxxflags and NIX_CFLAGS_COMPILE should be word-split exec -a "$0" @unwrapped@/bin/bindgen "$@" $sep $cxxflags @cincludes@ $NIX_CFLAGS_COMPILE # note that we add the flags after $@ which is incorrect. This is only for the sake # of simplicity. -