1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 coeurl,
8 curl,
9 libevent,
10 nlohmann_json,
11 olm,
12 openssl,
13 re2,
14 spdlog,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "mtxclient";
19 version = "0.10.0";
20
21 src = fetchFromGitHub {
22 owner = "Nheko-Reborn";
23 repo = "mtxclient";
24 rev = "v${version}";
25 hash = "sha256-luWcbYCv5OM3aidxiO7glqD+VYnCZMElZYaPKbtvMYI=";
26 };
27
28 postPatch = ''
29 # See https://github.com/gabime/spdlog/issues/1897
30 sed -i '1a add_compile_definitions(SPDLOG_FMT_EXTERNAL)' CMakeLists.txt
31 '';
32
33 cmakeFlags = [
34 # Network requiring tests can't be disabled individually:
35 # https://github.com/Nheko-Reborn/mtxclient/issues/22
36 "-DBUILD_LIB_TESTS=OFF"
37 "-DBUILD_LIB_EXAMPLES=OFF"
38 ];
39
40 nativeBuildInputs = [
41 cmake
42 pkg-config
43 ];
44
45 buildInputs = [
46 coeurl
47 curl
48 libevent
49 nlohmann_json
50 olm
51 openssl
52 re2
53 spdlog
54 ];
55
56 meta = with lib; {
57 description = "Client API library for the Matrix protocol";
58 homepage = "https://github.com/Nheko-Reborn/mtxclient";
59 license = licenses.mit;
60 maintainers = with maintainers; [
61 fpletz
62 pstn
63 rnhmjoj
64 ];
65 platforms = platforms.all;
66 # Should be fixable if a higher clang version is used, see:
67 # https://github.com/NixOS/nixpkgs/pull/85922#issuecomment-619287177
68 broken = stdenv.hostPlatform.isDarwin;
69 };
70}