at 24.05-pre 51 lines 1.3 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, rustPlatform 5, cmake 6, python3Packages 7, Security 8}: 9 10rustPlatform.buildRustPackage rec { 11 pname = "rust-cbindgen"; 12 version = "0.26.0"; 13 14 src = fetchFromGitHub { 15 owner = "mozilla"; 16 repo = "cbindgen"; 17 rev = "v${version}"; 18 hash = "sha256-gyNZAuxpeOjuC+Rh9jAyHSBQRRYUlYoIrBKuCFg3Hao="; 19 }; 20 21 cargoSha256 = "sha256-pdTxhECAZzBx5C01Yx7y/OGwhhAdlEDpqLBdvQcb8bc="; 22 23 buildInputs = lib.optional stdenv.isDarwin Security; 24 25 nativeCheckInputs = [ 26 cmake 27 python3Packages.cython 28 ]; 29 30 checkFlags = [ 31 # Disable tests that require rust unstable features 32 # https://github.com/eqrion/cbindgen/issues/338 33 "--skip test_expand" 34 "--skip test_bitfield" 35 "--skip lib_default_uses_debug_build" 36 "--skip lib_explicit_debug_build" 37 "--skip lib_explicit_release_build" 38 ] ++ lib.optionals stdenv.isDarwin [ 39 # WORKAROUND: test_body fails when using clang 40 # https://github.com/eqrion/cbindgen/issues/628 41 "--skip test_body" 42 ]; 43 44 meta = with lib; { 45 changelog = "https://github.com/mozilla/cbindgen/blob/v${version}/CHANGES"; 46 description = "A project for generating C bindings from Rust code"; 47 homepage = "https://github.com/mozilla/cbindgen"; 48 license = licenses.mpl20; 49 maintainers = with maintainers; [ hexa ]; 50 }; 51}