forked from mirrors/nixpkgs
5f8cf0048e
The biggest benefit is that we no longer have to update the registry package. This means that just about any cargo package can be built by nix. No longer does `cargo update` need to be feared because it will update to packages newer then what is available in nixpkgs. Instead of fetching the cargo registry this bundles all the source code into a "vendor/" folder. This also uses the new --frozen and --locked flags which is nice. Currently cargo-vendor only provides binaries for Linux and macOS 64-bit. This can be solved by building it for the other architectures and uploading it somewhere (like the NixOS cache). This also has the downside that it requires a change to everyone's deps hash. And if the old one is used because it was cached it will fail to build as it will attempt to use the old version. For this reason the attribute has been renamed to `cargoSha256`. Authors: * Kevin Cox <kevincox@kevincox.ca> * Jörg Thalheim <Mic92@users.noreply.github.com> * zimbatm <zimbatm@zimbatm.com>
38 lines
1.1 KiB
Nix
38 lines
1.1 KiB
Nix
{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, llvmPackages }:
|
|
|
|
# Future work: Automatically communicate NIX_CFLAGS_COMPILE to bindgen's tests and the bindgen executable itself.
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
name = "rust-bindgen-${version}";
|
|
version = "0.30.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "rust-lang-nursery";
|
|
repo = "rust-bindgen";
|
|
rev = "v${version}";
|
|
sha256 = "02ic48qng76rvwa54i8zkvqgr8kfsyj3axc08naylzcvwzp84bsf";
|
|
};
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
buildInputs = [ llvmPackages.clang-unwrapped ];
|
|
|
|
configurePhase = ''
|
|
export LIBCLANG_PATH="${llvmPackages.clang-unwrapped}/lib"
|
|
'';
|
|
|
|
postInstall = ''
|
|
wrapProgram $out/bin/bindgen --set LIBCLANG_PATH "${llvmPackages.clang-unwrapped}/lib"
|
|
'';
|
|
|
|
cargoSha256 = "128skg31lc9v8i7ghfb3wyiazivqfvzhi1mvmjcl0gkx1hi5006v";
|
|
|
|
doCheck = false; # A test fails because it can't find standard headers in NixOS
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "C and C++ binding generator";
|
|
homepage = https://github.com/rust-lang-nursery/rust-bindgen;
|
|
license = with licenses; [ bsd3 ];
|
|
maintainers = [ maintainers.ralith ];
|
|
};
|
|
}
|