Rust bindgen and c header packaging

I am trying to use bindgen to generate bindings to a C header file. But I encounter errors which I believe are due to it not resolving the #include within the header file. I am assuming this is because I am packaging the kernel module wrong.

I started by packaging a kernel module that has a header file. It copies the header directory into a dev output.

In my rust project, I include the rustPlatform.bindgenHook and exmap in the nativeBuildInputs. My build.rs file picks up the #include <linux/exmap.h> file correctly but it fails due to a clang diagnostic:

--- stderr
  /nix/store/719zzzaknzfn184bxr7jhkyg8r3hxb1b-exmap-dev/include/linux/exmap.h:15:3: error: unknown type name 'uint64_t'
  /nix/store/719zzzaknzfn184bxr7jhkyg8r3hxb1b-exmap-dev/include/linux/exmap.h:17:4: error: unknown type name 'uint64_t'
....
 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ClangDiagnostic(...)

I have tried bindgen with this setup on other nix packages such as liburing which work great. I cannot figure out what those packages do differently

The linux/exmap.h file includes two kernel headers.:

#include <asm/ioctl.h>
#include <linux/types.h>

Figured out the header it was missing. Needed to add the following. Still interested to know what needs to be done to get the include part of the dev output.

NIX_CFLAGS_COMPILE = "-I${pkgs.linuxPackages_latest.kernel.dev}/lib/modules/${pkgs.linuxPackages_latest.kernel.modDirVersion}/source/include";