nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rustPlatform,
6 cmake,
7 python3Packages,
8
9 # tests
10 firefox-unwrapped,
11 firefox-esr-unwrapped,
12 mesa,
13}:
14
15rustPlatform.buildRustPackage rec {
16 pname = "rust-cbindgen";
17 version = "0.29.2";
18
19 src = fetchFromGitHub {
20 owner = "mozilla";
21 repo = "cbindgen";
22 rev = "v${version}";
23 hash = "sha256-P2A+XSLrcuYsI48gnZSNNs5qX+EatiuEJSEJbMvMSxg=";
24 };
25
26 cargoHash = "sha256-DbmlpjiOraLWPh5RgJqCIGIYzE1h82MH2S6gpLH+CIQ=";
27
28 nativeCheckInputs = [
29 cmake
30 python3Packages.cython
31 ];
32
33 checkFlags = [
34 # Disable tests that require rust unstable features
35 # https://github.com/eqrion/cbindgen/issues/338
36 "--skip=test_expand"
37 "--skip=test_bitfield"
38 "--skip=lib_default_uses_debug_build"
39 "--skip=lib_explicit_debug_build"
40 "--skip=lib_explicit_release_build"
41 ]
42 ++ lib.optionals stdenv.hostPlatform.isDarwin [
43 # WORKAROUND: test_body fails when using clang
44 # https://github.com/eqrion/cbindgen/issues/628
45 "--skip=test_body"
46 ];
47
48 passthru.tests = {
49 inherit
50 firefox-unwrapped
51 firefox-esr-unwrapped
52 mesa
53 ;
54 };
55
56 meta = {
57 changelog = "https://github.com/mozilla/cbindgen/blob/v${version}/CHANGES";
58 description = "Project for generating C bindings from Rust code";
59 mainProgram = "cbindgen";
60 homepage = "https://github.com/mozilla/cbindgen";
61 license = lib.licenses.mpl20;
62 maintainers = with lib.maintainers; [ hexa ];
63 };
64}