From 9f0da72abc39765471b60f7d33bb011eb5456bfb Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 3 Oct 2019 16:59:06 +0300 Subject: [PATCH] matrix-synapse: factor out plugins We build plugins separately from the server now. --- pkgs/servers/matrix-synapse/default.nix | 27 +++++-------------- .../matrix-synapse/plugins/default.nix | 5 ++++ pkgs/servers/matrix-synapse/plugins/ldap3.nix | 17 ++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 pkgs/servers/matrix-synapse/plugins/default.nix create mode 100644 pkgs/servers/matrix-synapse/plugins/ldap3.nix diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix index d2c1afa0e7ca..15df735b7072 100644 --- a/pkgs/servers/matrix-synapse/default.nix +++ b/pkgs/servers/matrix-synapse/default.nix @@ -5,23 +5,9 @@ with python3.pkgs; let - matrix-synapse-ldap3 = buildPythonPackage rec { - pname = "matrix-synapse-ldap3"; - version = "0.1.4"; - - src = fetchPypi { - inherit pname version; - sha256 = "01bms89sl16nyh9f141idsz4mnhxvjrc3gj721wxh1fhikps0djx"; - }; - - propagatedBuildInputs = [ service-identity ldap3 twisted ]; - - # ldaptor is not ready for py3 yet - doCheck = !isPy3k; - checkInputs = [ ldaptor mock ]; - }; - -in buildPythonApplication rec { + plugins = python3.pkgs.callPackage ./plugins { }; +in +buildPythonApplication rec { pname = "matrix-synapse"; version = "1.14.0"; @@ -45,7 +31,6 @@ in buildPythonApplication rec { jinja2 jsonschema lxml - matrix-synapse-ldap3 msgpack netaddr phonenumbers @@ -79,12 +64,14 @@ in buildPythonApplication rec { doCheck = !stdenv.isDarwin; - passthru.tests = { inherit (nixosTests) matrix-synapse; }; - checkPhase = '' PYTHONPATH=".:$PYTHONPATH" ${python3.interpreter} -m twisted.trial tests ''; + passthru.tests = { inherit (nixosTests) matrix-synapse; }; + passthru.plugins = plugins; + passthru.python = python3; + meta = with stdenv.lib; { homepage = "https://matrix.org"; description = "Matrix reference homeserver"; diff --git a/pkgs/servers/matrix-synapse/plugins/default.nix b/pkgs/servers/matrix-synapse/plugins/default.nix new file mode 100644 index 000000000000..e32ba673d291 --- /dev/null +++ b/pkgs/servers/matrix-synapse/plugins/default.nix @@ -0,0 +1,5 @@ +{ callPackage }: + +{ + matrix-synapse-ldap3 = callPackage ./ldap3.nix { }; +} diff --git a/pkgs/servers/matrix-synapse/plugins/ldap3.nix b/pkgs/servers/matrix-synapse/plugins/ldap3.nix new file mode 100644 index 000000000000..9f1aec20033b --- /dev/null +++ b/pkgs/servers/matrix-synapse/plugins/ldap3.nix @@ -0,0 +1,17 @@ +{ isPy3k, buildPythonPackage, fetchPypi, service-identity, ldap3, twisted, ldaptor, mock }: + +buildPythonPackage rec { + pname = "matrix-synapse-ldap3"; + version = "0.1.4"; + + src = fetchPypi { + inherit pname version; + sha256 = "01bms89sl16nyh9f141idsz4mnhxvjrc3gj721wxh1fhikps0djx"; + }; + + propagatedBuildInputs = [ service-identity ldap3 twisted ]; + + # ldaptor is not ready for py3 yet + doCheck = !isPy3k; + checkInputs = [ ldaptor mock ]; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2f6c5dfea4f8..cee2dd78fccc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4706,6 +4706,8 @@ in (https://github.com/NixOS/nixpkgs/issues/76093) */ matrix-synapse = callPackage ../servers/matrix-synapse { /*python3 = python38;*/ }; + matrix-synapse-plugins = recurseIntoAttrs matrix-synapse.plugins; + matrix-appservice-slack = callPackage ../servers/matrix-synapse/matrix-appservice-slack {}; mautrix-telegram = recurseIntoAttrs (callPackage ../servers/mautrix-telegram { });