@@ -0,0 +1,34 @@
1+{ stdenv, fetchFromGitHub, rustPlatform, llvmPackages }:
2+
3+with rustPlatform;
4+
5+# Future work: Automatically communicate NIX_CFLAGS_COMPILE to bindgen's tests and the bindgen executable itself.
6+
7+buildRustPackage rec {
8+ name = "rust-bindgen-${version}";
9+ version = "0.19.1";
10+
11+ src = fetchFromGitHub {
12+ owner = "Yamakaky";
13+ repo = "rust-bindgen";
14+ rev = "${version}";
15+ sha256 = "0pv1vcgp455hys8hb0yj4vrh2k01zysayswkasxq4hca8s2p7qj9";
16+ };
17+
18+ buildInputs = [ llvmPackages.clang-unwrapped ];
19+
20+ configurePhase = ''
21+ export LIBCLANG_PATH="${llvmPackages.clang-unwrapped}/lib"
22+ '';
23+
24+ depsSha256 = "0rlmdiqjg9ha9yzhcy33abvhrck6sphczc2gbab9zhfa95gxprv8";
25+
26+ doCheck = false; # A test fails because it can't find standard headers in NixOS
27+
28+ meta = with stdenv.lib; {
29+ description = "C binding generator";
30+ homepage = https://github.com/Yamakaky/rust-bindgen;
31+ license = with licenses; [ bsd3 ];
32+ maintainers = [ maintainers.ralith ];
33+ };
34+}