2022-10-21 18:38:19 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, python3, openssl, rustPlatform
|
2020-04-24 23:36:52 +00:00
|
|
|
, enableSystemd ? stdenv.isLinux, nixosTests
|
2021-10-04 12:37:57 +00:00
|
|
|
, enableRedis ? true
|
2020-12-25 13:55:36 +00:00
|
|
|
, callPackage
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
let
|
2021-12-06 16:07:01 +00:00
|
|
|
plugins = python3.pkgs.callPackage ./plugins { };
|
2020-12-25 13:55:36 +00:00
|
|
|
tools = callPackage ./tools { };
|
2020-06-18 07:06:33 +00:00
|
|
|
in
|
2021-12-06 16:07:01 +00:00
|
|
|
with python3.pkgs;
|
2020-06-18 07:06:33 +00:00
|
|
|
buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "matrix-synapse";
|
2022-11-02 22:02:43 +00:00
|
|
|
version = "1.70.1";
|
2022-09-30 11:47:45 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "matrix-org";
|
|
|
|
repo = "synapse";
|
|
|
|
rev = "v${version}";
|
2022-11-02 22:02:43 +00:00
|
|
|
hash = "sha256-/clEY3sabaDEOAAowQ896vYOvzf5Teevoa7ZkzWw+fY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2022-11-02 22:02:43 +00:00
|
|
|
hash = "sha256-9wxWxrn+uPcz60710DROhDqNC6FvTtnqzWiWRk8kl6A=";
|
2022-09-30 11:47:45 +00:00
|
|
|
};
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Remove setuptools_rust from runtime dependencies
|
|
|
|
# https://github.com/matrix-org/synapse/blob/v1.69.0/pyproject.toml#L177-L185
|
|
|
|
sed -i '/^setuptools_rust =/d' pyproject.toml
|
|
|
|
'';
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
setuptools-rust
|
|
|
|
] ++ (with rustPlatform.rust; [
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
]);
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = [ openssl ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-06-04 09:07:49 +00:00
|
|
|
authlib
|
2020-04-24 23:36:52 +00:00
|
|
|
bcrypt
|
|
|
|
bleach
|
|
|
|
canonicaljson
|
|
|
|
daemonize
|
|
|
|
frozendict
|
2021-06-04 09:07:49 +00:00
|
|
|
ijson
|
2020-04-24 23:36:52 +00:00
|
|
|
jinja2
|
|
|
|
jsonschema
|
|
|
|
lxml
|
2022-01-19 23:45:15 +00:00
|
|
|
matrix-common
|
2020-04-24 23:36:52 +00:00
|
|
|
msgpack
|
|
|
|
netaddr
|
|
|
|
phonenumbers
|
|
|
|
pillow
|
2021-08-27 14:25:00 +00:00
|
|
|
prometheus-client
|
2020-04-24 23:36:52 +00:00
|
|
|
psutil
|
|
|
|
psycopg2
|
|
|
|
pyasn1
|
2022-09-09 14:08:57 +00:00
|
|
|
pydantic
|
2021-06-04 09:07:49 +00:00
|
|
|
pyjwt
|
2020-04-24 23:36:52 +00:00
|
|
|
pymacaroons
|
|
|
|
pynacl
|
|
|
|
pyopenssl
|
|
|
|
pysaml2
|
|
|
|
pyyaml
|
|
|
|
requests
|
2021-06-04 09:07:49 +00:00
|
|
|
setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
signedjson
|
|
|
|
sortedcontainers
|
|
|
|
treq
|
|
|
|
twisted
|
|
|
|
typing-extensions
|
2021-06-04 09:07:49 +00:00
|
|
|
unpaddedbase64
|
2020-11-03 02:18:15 +00:00
|
|
|
] ++ lib.optional enableSystemd systemd
|
2021-06-28 23:13:55 +00:00
|
|
|
++ lib.optionals enableRedis [ hiredis txredisapi ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkInputs = [ mock parameterized openssl ];
|
|
|
|
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
|
|
|
checkPhase = ''
|
2022-09-30 11:47:45 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
# remove src module, so tests use the installed module instead
|
|
|
|
rm -rf ./synapse
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
PYTHONPATH=".:$PYTHONPATH" ${python3.interpreter} -m twisted.trial -j $NIX_BUILD_CORES tests
|
2022-09-30 11:47:45 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) matrix-synapse; };
|
|
|
|
passthru.plugins = plugins;
|
2020-12-25 13:55:36 +00:00
|
|
|
passthru.tools = tools;
|
2021-12-06 16:07:01 +00:00
|
|
|
passthru.python = python3;
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://matrix.org";
|
|
|
|
description = "Matrix reference homeserver";
|
|
|
|
license = licenses.asl20;
|
2020-06-18 07:06:33 +00:00
|
|
|
maintainers = teams.matrix.members;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|