tuicam: init at 0.0.2 (#377825)
[NixPkgs.git] / pkgs / by-name / cx / cxx-rs / package.nix
blob88d0bf8d66376a01d291d391f426af34c2aa43a5
2   cxx-rs,
3   fetchFromGitHub,
4   lib,
5   rustPlatform,
6   testers,
7 }:
9 rustPlatform.buildRustPackage rec {
10   pname = "cxx-rs";
11   version = "1.0.131";
13   src = fetchFromGitHub {
14     owner = "dtolnay";
15     repo = "cxx";
16     rev = version;
17     sha256 = "sha256-KQlbJvULdc94SM0sx6JtukZPpaX4Gojc6Qgr20V3/VI=";
18   };
20   cargoLock = {
21     lockFile = ./Cargo.lock;
22   };
24   postPatch = ''
25     cp ${./Cargo.lock} Cargo.lock
26   '';
28   cargoBuildFlags = [
29     "--workspace"
30     "--exclude=demo"
31   ];
33   postBuild = ''
34     cargo doc --release
35   '';
37   cargoTestFlags = [ "--workspace" ];
39   outputs = [
40     "out"
41     "doc"
42     "dev"
43   ];
45   postInstall = ''
46     mkdir -p $doc
47     cp -r ./target/doc/* $doc
49     mkdir -p $dev/include/rust
50     install -D -m 0644 ./include/cxx.h $dev/include/rust
51   '';
53   passthru.tests.version = testers.testVersion {
54     package = cxx-rs;
55     command = "cxxbridge --version";
56   };
58   meta = with lib; {
59     description = "Safe FFI between Rust and C++";
60     mainProgram = "cxxbridge";
61     homepage = "https://github.com/dtolnay/cxx";
62     license = licenses.mit;
63     maintainers = with maintainers; [ centromere ];
64   };