about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/corrosion/default.nix
blob: 6809ee7ffd7acf6f04b42473d27f699324614366 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, stdenv
, fetchFromGitHub
, cargo
, cmake
, rustc
, libiconv
}:

stdenv.mkDerivation rec {
  pname = "corrosion";
  version = "0.5";

  src = fetchFromGitHub {
    owner = "corrosion-rs";
    repo = "corrosion";
    rev = "v${version}";
    hash = "sha256-vaNXXXaGqYNmhonU+ANN857LAUgwv+PMcON+nBuUoeo=";
  };

  buildInputs = lib.optional stdenv.isDarwin libiconv;

  nativeBuildInputs = [
    cmake
    cargo
    rustc
  ];

  doCheck = true;

  checkPhase = let
    excludedTests = [
      "cbindgen_rust2cpp_build"
      "cbindgen_rust2cpp_run_cpp-exe"
      "hostbuild_build"
      "hostbuild_run_rust-host-program"
      "parse_target_triple_build"
      "rustup_proxy_build"
    ];
    excludedTestsRegex = lib.concatStringsSep "|" excludedTests;
  in ''
    runHook preCheck

    ctest -E "${excludedTestsRegex}"

    runHook postCheck
  '';

  meta = with lib; {
    description = "Tool for integrating Rust into an existing CMake project";
    homepage = "https://github.com/corrosion-rs/corrosion";
    changelog = "https://github.com/corrosion-rs/corrosion/blob/${src.rev}/RELEASES.md";
    license = licenses.mit;
    maintainers = with maintainers; [ dotlambda ];
  };
}