Extract flags/settings from clang wrapper

Hello. I’m trying to package a library+application thingy which uses clang’s python bindings (which I’ve already packaged) in its build process and it needs to set in proper flags, include paths, etc… to its python methods calls / configuration classes.

Is there a way to obtain these flags and paths? I can e.g. add clang_9 wrapper as a buildInput or use llvmPackages_9.stdenv.mkDerivation and call clang -v -E - < /dev/null and extract various settings from the output but it seems very cumbersome and error-prone.
It there a better way?

I’d like to get at least the include paths. How does the clang wrapper obtain them anyway?
Thanks

Not sure if it is helpful, but you can refer to the include paths shown in the output of clang -v -E - < /dev/null within Nix like:

let
  compilerRtLibc = builtins.head clang_9.depsTargetTargetPropagated;
in
[
  "${compilerRtLibc}/include"
  "${clang_9}/resource-root/include"
  "${clang_9.libc_dev}/include"
]

I was looking for this: Using rust-bindgen in Nix.

${llvmPackages_9.stdenv.cc}/nix-support/*flags

contain half of the flags I need.
The other half is in "$NIX_CFLAGS_COMPILE" where they are added by mkDerivation according to specified dependencies.