Rust + OpenCV = libLLVM-16.so: cannot open shared object file

welcome @mamaf!
Two observations that stand out to me:

  • you’ll want to grab the llvmPackages.libclang too
  • libclang does not provide pkg-config files upstream so nix doesn’t appear to magically find them. So you need to populate the correct environment variable that points to the libraries

I ran into this before and found a solution here: How to correctly populate a clang and llvm development environment using nix-shell?

I’m curious if you can do this in a one liner. I was able to load nix-shell -p pkg-config opencv llvmPackages.libclang but couldn’t figure out how to specify a shellHook.
That said, I’d recommend you create an ad hoc shell environment as it makes this much simpler. If you are unfamiliar with that, check out the nix.dev guide: Ad hoc shell environments — nix.dev documentation