2023-01-20 10:41:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-05-03 17:38:23 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2021-12-06 16:07:01 +00:00
|
|
|
, coeurl
|
|
|
|
, curl
|
2023-01-20 10:41:00 +00:00
|
|
|
, libevent
|
|
|
|
, nlohmann_json
|
|
|
|
, olm
|
|
|
|
, openssl
|
|
|
|
, re2
|
|
|
|
, spdlog
|
2020-05-03 17:38:23 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mtxclient";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "0.9.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Nheko-Reborn";
|
|
|
|
repo = "mtxclient";
|
|
|
|
rev = "v${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-34iwYn9EOAl2c9UWERyzgwlZ+539jW9FygNYwgZ7ClU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postPatch = ''
|
|
|
|
# See https://github.com/gabime/spdlog/issues/1897
|
|
|
|
sed -i '1a add_compile_definitions(SPDLOG_FMT_EXTERNAL)' CMakeLists.txt
|
|
|
|
'';
|
2021-10-28 06:52:43 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
2020-05-03 17:38:23 +00:00
|
|
|
# Network requiring tests can't be disabled individually:
|
|
|
|
# https://github.com/Nheko-Reborn/mtxclient/issues/22
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DBUILD_LIB_TESTS=OFF"
|
|
|
|
"-DBUILD_LIB_EXAMPLES=OFF"
|
|
|
|
];
|
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-05-03 17:38:23 +00:00
|
|
|
];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
buildInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
coeurl
|
|
|
|
curl
|
2023-01-20 10:41:00 +00:00
|
|
|
libevent
|
|
|
|
nlohmann_json
|
|
|
|
olm
|
|
|
|
openssl
|
|
|
|
re2
|
|
|
|
spdlog
|
2020-05-03 17:38:23 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/201254
|
|
|
|
NIX_LDFLAGS = lib.optionalString (stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU) "-lgcc";
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-12-06 16:07:01 +00:00
|
|
|
description = "Client API library for the Matrix protocol.";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/Nheko-Reborn/mtxclient";
|
|
|
|
license = licenses.mit;
|
2021-02-05 17:12:51 +00:00
|
|
|
maintainers = with maintainers; [ fpletz pstn ];
|
2020-05-03 17:38:23 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
# Should be fixable if a higher clang version is used, see:
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/85922#issuecomment-619287177
|
|
|
|
broken = stdenv.targetPlatform.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|