Building any nRF firmware from `nix develop` fails in the build script of
nrf-mpsl-sys:
Unable to find libclang: "couldn't find any valid shared libraries
matching: ['libclang.so', ...], set the `LIBCLANG_PATH` environment
variable to a path where one of these files can be found"
Both nrf-mpsl-sys and nrf-sdc-sys generate their bindings with bindgen, which
dlopens libclang at build time. The dev shell ships a full Rust toolchain and
the embedded tooling but never provided one, so every contributor had to dig a
clang out of the store and pass LIBCLANG_PATH by hand.
Point it at pkgs.llvmPackages.libclang. Verified by building keyboards/k04
central from a clean CARGO_TARGET_DIR inside `nix develop` with no manually
exported variables; nrf-mpsl-sys and nrf-sdc-sys both compile.
No BINDGEN_EXTRA_CLANG_ARGS is needed here — scripts/build_k04_matrix.sh still
derives its own when it wants ARM headers, and a plain cargo build does not.
Problem
Building any nRF firmware from inside
nix developfails in thenrf-mpsl-sysbuild script:nrf-mpsl-sysandnrf-sdc-sysgenerate their bindings with bindgen, which dlopens libclang at build-script time. The dev shell ships the full Rust toolchain, the embedded targets,flip-link,probe-rs,cargo-binutils— but no libclang, so anyone building firmware has to find a clang in the store and exportLIBCLANG_PATHby hand every time.Fix
Set
LIBCLANG_PATHtopkgs.llvmPackages.libclangin the dev shell env.Testing
Built
keyboards/k04central from a cleanCARGO_TARGET_DIRinsidenix develop, with no manually exported variables —nrf-mpsl-sysandnrf-sdc-sysboth compile and the build finishes.alejandra --checkis clean.Note
No
BINDGEN_EXTRA_CLANG_ARGSis added: a plaincargo builddoesn't need it, andscripts/build_k04_matrix.shalready derives its own when it wants ARM headers.