summary refs log tree commit diff
path: root/pkgs/servers/matrix-conduit/default.nix
blob: 5f8fe6a2cc2057423f35fa8861bdd28c2fef5131 (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
{ lib, rustPlatform, fetchFromGitLab, stdenv, darwin, nixosTests, rocksdb_6_23 }:

rustPlatform.buildRustPackage rec {
  pname = "matrix-conduit";
  version = "0.5.0";

  src = fetchFromGitLab {
    owner = "famedly";
    repo = "conduit";
    rev = "v${version}";
    sha256 = "sha256-GSCpmn6XRbmnfH31R9c6QW3/pez9KHPjI99dR+ln0P4=";
  };

  # https://github.com/rust-lang/cargo/issues/11192
  # https://github.com/ruma/ruma/issues/1441
  postPatch = ''
    pushd $cargoDepsCopy
    patch -p0 < ${./cargo-11192-workaround.patch}
    for p in ruma*; do echo '{"files":{},"package":null}' > $p/.cargo-checksum.json; done
    popd
  '';

  cargoSha256 = "sha256-WFoupcuaG7f7KYBn/uzbOzlHHLurOyvm5e1lEcinxC8=";

  nativeBuildInputs = [
    rustPlatform.bindgenHook
  ];

  buildInputs = lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.Security
  ];

  ROCKSDB_INCLUDE_DIR = "${rocksdb_6_23}/include";
  ROCKSDB_LIB_DIR = "${rocksdb_6_23}/lib";

  # tests failed on x86_64-darwin with SIGILL: illegal instruction
  doCheck = !(stdenv.isx86_64 && stdenv.isDarwin);

  passthru.tests = {
    inherit (nixosTests) matrix-conduit;
  };

  meta = with lib; {
    description = "A Matrix homeserver written in Rust";
    homepage = "https://conduit.rs/";
    license = licenses.asl20;
    maintainers = with maintainers; [ pstn piegames pimeys ];
    mainProgram = "conduit";
  };
}