summaryrefslogtreecommitdiff
path: root/overlays/matrix-synapse
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-11-07 20:51:39 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-11-07 20:51:39 +0100
commit0e9f1e85cd8c6f9d546ef88e971043b909017170 (patch)
tree5cb4d14df7594ef123f20d82cb2ec423b6bca744 /overlays/matrix-synapse
parentf563ddece04adfd8d80d4e984405f5c70a6c94f3 (diff)
downloadnixos-0e9f1e85cd8c6f9d546ef88e971043b909017170.tar
nixos-0e9f1e85cd8c6f9d546ef88e971043b909017170.tar.gz
nixos-0e9f1e85cd8c6f9d546ef88e971043b909017170.tar.bz2
nixos-0e9f1e85cd8c6f9d546ef88e971043b909017170.tar.xz
nixos-0e9f1e85cd8c6f9d546ef88e971043b909017170.zip
...
Diffstat (limited to 'overlays/matrix-synapse')
-rw-r--r--overlays/matrix-synapse/1.70.1/default.nix111
-rw-r--r--overlays/matrix-synapse/1.70.1/plugins/default.nix8
-rw-r--r--overlays/matrix-synapse/1.70.1/plugins/ldap3.nix17
-rw-r--r--overlays/matrix-synapse/1.70.1/plugins/mjolnir-antispam.nix32
-rw-r--r--overlays/matrix-synapse/1.70.1/plugins/pam.nix15
-rw-r--r--overlays/matrix-synapse/1.70.1/plugins/shared-secret-auth.nix26
-rw-r--r--overlays/matrix-synapse/1.70.1/tools/default.nix6
-rw-r--r--overlays/matrix-synapse/1.70.1/tools/rust-synapse-compress-state.nix30
-rw-r--r--overlays/matrix-synapse/1.70.1/tools/synadm.nix47
-rw-r--r--overlays/matrix-synapse/default.nix3
10 files changed, 295 insertions, 0 deletions
diff --git a/overlays/matrix-synapse/1.70.1/default.nix b/overlays/matrix-synapse/1.70.1/default.nix
new file mode 100644
index 00000000..0c026914
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/default.nix
@@ -0,0 +1,111 @@
1{ lib, stdenv, fetchFromGitHub, python3, openssl, rustPlatform
2, enableSystemd ? stdenv.isLinux, nixosTests
3, enableRedis ? true
4, callPackage
5}:
6
7let
8 plugins = python3.pkgs.callPackage ./plugins { };
9 tools = callPackage ./tools { };
10in
11with python3.pkgs;
12buildPythonApplication rec {
13 pname = "matrix-synapse";
14 version = "1.70.1";
15 format = "pyproject";
16
17 src = fetchFromGitHub {
18 owner = "matrix-org";
19 repo = "synapse";
20 rev = "v${version}";
21 hash = "sha256-/clEY3sabaDEOAAowQ896vYOvzf5Teevoa7ZkzWw+fY=";
22 };
23
24 cargoDeps = rustPlatform.fetchCargoTarball {
25 inherit src;
26 name = "${pname}-${version}";
27 hash = "sha256-9wxWxrn+uPcz60710DROhDqNC6FvTtnqzWiWRk8kl6A=";
28 };
29
30 postPatch = ''
31 # Remove setuptools_rust from runtime dependencies
32 # https://github.com/matrix-org/synapse/blob/v1.69.0/pyproject.toml#L177-L185
33 sed -i '/^setuptools_rust =/d' pyproject.toml
34 '';
35
36 nativeBuildInputs = [
37 poetry-core
38 rustPlatform.cargoSetupHook
39 setuptools-rust
40 ] ++ (with rustPlatform.rust; [
41 cargo
42 rustc
43 ]);
44
45 buildInputs = [ openssl ];
46
47 propagatedBuildInputs = [
48 authlib
49 bcrypt
50 bleach
51 canonicaljson
52 daemonize
53 frozendict
54 ijson
55 jinja2
56 jsonschema
57 lxml
58 matrix-common
59 msgpack
60 netaddr
61 phonenumbers
62 pillow
63 prometheus-client
64 psutil
65 psycopg2
66 pyasn1
67 pydantic
68 pyjwt
69 pymacaroons
70 pynacl
71 pyopenssl
72 pysaml2
73 pyyaml
74 requests
75 setuptools
76 signedjson
77 sortedcontainers
78 treq
79 twisted
80 typing-extensions
81 unpaddedbase64
82 ] ++ lib.optional enableSystemd systemd
83 ++ lib.optionals enableRedis [ hiredis txredisapi ];
84
85 checkInputs = [ mock parameterized openssl ];
86
87 doCheck = !stdenv.isDarwin;
88
89 checkPhase = ''
90 runHook preCheck
91
92 # remove src module, so tests use the installed module instead
93 rm -rf ./synapse
94
95 PYTHONPATH=".:$PYTHONPATH" ${python3.interpreter} -m twisted.trial -j $NIX_BUILD_CORES tests
96
97 runHook postCheck
98 '';
99
100 passthru.tests = { inherit (nixosTests) matrix-synapse; };
101 passthru.plugins = plugins;
102 passthru.tools = tools;
103 passthru.python = python3;
104
105 meta = with lib; {
106 homepage = "https://matrix.org";
107 description = "Matrix reference homeserver";
108 license = licenses.asl20;
109 maintainers = teams.matrix.members;
110 };
111}
diff --git a/overlays/matrix-synapse/1.70.1/plugins/default.nix b/overlays/matrix-synapse/1.70.1/plugins/default.nix
new file mode 100644
index 00000000..e67d9075
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/plugins/default.nix
@@ -0,0 +1,8 @@
1{ callPackage }:
2
3{
4 matrix-synapse-ldap3 = callPackage ./ldap3.nix { };
5 matrix-synapse-mjolnir-antispam = callPackage ./mjolnir-antispam.nix { };
6 matrix-synapse-pam = callPackage ./pam.nix { };
7 matrix-synapse-shared-secret-auth = callPackage ./shared-secret-auth.nix { };
8}
diff --git a/overlays/matrix-synapse/1.70.1/plugins/ldap3.nix b/overlays/matrix-synapse/1.70.1/plugins/ldap3.nix
new file mode 100644
index 00000000..394c0f5e
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/plugins/ldap3.nix
@@ -0,0 +1,17 @@
1{ isPy3k, buildPythonPackage, fetchPypi, service-identity, ldap3, twisted, ldaptor, mock }:
2
3buildPythonPackage rec {
4 pname = "matrix-synapse-ldap3";
5 version = "0.1.5";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "9fdf8df7c8ec756642aa0fea53b31c0b2f1924f70d7f049a2090b523125456fe";
10 };
11
12 propagatedBuildInputs = [ service-identity ldap3 twisted ];
13
14 # ldaptor is not ready for py3 yet
15 doCheck = !isPy3k;
16 checkInputs = [ ldaptor mock ];
17}
diff --git a/overlays/matrix-synapse/1.70.1/plugins/mjolnir-antispam.nix b/overlays/matrix-synapse/1.70.1/plugins/mjolnir-antispam.nix
new file mode 100644
index 00000000..7372c2f7
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/plugins/mjolnir-antispam.nix
@@ -0,0 +1,32 @@
1{ lib, buildPythonPackage, fetchFromGitHub, matrix-synapse }:
2
3buildPythonPackage rec {
4 pname = "matrix-synapse-mjolnir-antispam";
5 version = "1.5.0";
6
7 src = fetchFromGitHub {
8 owner = "matrix-org";
9 repo = "mjolnir";
10 rev = "refs/tags/v${version}";
11 sha256 = "sha256-YmP+r9W5e63Aw66lSQeTTbYwSF/vjPyHkoehJxtcRNw=";
12 };
13
14 sourceRoot = "./source/synapse_antispam";
15
16 propagatedBuildInputs = [ matrix-synapse ];
17
18 doCheck = false; # no tests
19 pythonImportsCheck = [ "mjolnir" ];
20
21 meta = with lib; {
22 description = "AntiSpam / Banlist plugin to be used with mjolnir";
23 longDescription = ''
24 Primarily meant to block invites from undesired homeservers/users,
25 Mjolnir's Synapse module is a way to interpret ban lists and apply
26 them to your entire homeserver.
27 '';
28 homepage = "https://github.com/matrix-org/mjolnir#synapse-module";
29 license = licenses.asl20;
30 maintainers = with maintainers; [ jojosch ];
31 };
32}
diff --git a/overlays/matrix-synapse/1.70.1/plugins/pam.nix b/overlays/matrix-synapse/1.70.1/plugins/pam.nix
new file mode 100644
index 00000000..a14fe6d6
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/plugins/pam.nix
@@ -0,0 +1,15 @@
1{ buildPythonPackage, fetchFromGitHub, twisted, python-pam }:
2
3buildPythonPackage rec {
4 pname = "matrix-synapse-pam";
5 version = "0.1.3";
6
7 src = fetchFromGitHub {
8 owner = "14mRh4X0r";
9 repo = "matrix-synapse-pam";
10 rev = "v${version}";
11 sha256 = "0jgz49cwiyih5cg3hr4byva04zjnq8aj7rima9874la9fc5sd2wf";
12 };
13
14 propagatedBuildInputs = [ twisted python-pam ];
15}
diff --git a/overlays/matrix-synapse/1.70.1/plugins/shared-secret-auth.nix b/overlays/matrix-synapse/1.70.1/plugins/shared-secret-auth.nix
new file mode 100644
index 00000000..a6e22db3
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/plugins/shared-secret-auth.nix
@@ -0,0 +1,26 @@
1{ lib, buildPythonPackage, fetchFromGitHub, matrix-synapse, twisted }:
2
3buildPythonPackage rec {
4 pname = "matrix-synapse-shared-secret-auth";
5 version = "2.0.2";
6
7 src = fetchFromGitHub {
8 owner = "devture";
9 repo = "matrix-synapse-shared-secret-auth";
10 rev = version;
11 sha256 = "sha256-qzXKwTEOMtdvsxoU3Xh3vQyhK+Q18LfkeSts7EyDIXE=";
12 };
13
14 doCheck = false;
15 pythonImportsCheck = [ "shared_secret_authenticator" ];
16
17 buildInputs = [ matrix-synapse ];
18 propagatedBuildInputs = [ twisted ];
19
20 meta = with lib; {
21 description = "Shared Secret Authenticator password provider module for Matrix Synapse";
22 homepage = "https://github.com/devture/matrix-synapse-shared-secret-auth";
23 license = licenses.agpl3Plus;
24 maintainers = with maintainers; [ sumnerevans ];
25 };
26}
diff --git a/overlays/matrix-synapse/1.70.1/tools/default.nix b/overlays/matrix-synapse/1.70.1/tools/default.nix
new file mode 100644
index 00000000..defc35bc
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/tools/default.nix
@@ -0,0 +1,6 @@
1{ callPackage }:
2{
3 rust-synapse-compress-state = callPackage ./rust-synapse-compress-state.nix { };
4
5 synadm = callPackage ./synadm.nix { };
6}
diff --git a/overlays/matrix-synapse/1.70.1/tools/rust-synapse-compress-state.nix b/overlays/matrix-synapse/1.70.1/tools/rust-synapse-compress-state.nix
new file mode 100644
index 00000000..fcf123d6
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/tools/rust-synapse-compress-state.nix
@@ -0,0 +1,30 @@
1{ lib, rustPlatform, python3, fetchFromGitHub, pkg-config, openssl }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "rust-synapse-compress-state";
5 version = "0.1.3";
6
7 src = fetchFromGitHub {
8 owner = "matrix-org";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-SSfVtG8kwHarVbB1O7xC2SSbUpPGYMHTMyoxu8mpEk0=";
12 };
13
14 cargoSha256 = "sha256-PG+UeovhJMsIlm5dOYdtMxbUxZjwG3V59kAcB9aFP5c=";
15
16 cargoBuildFlags = [
17 "--all"
18 ];
19
20 nativeBuildInputs = [ python3 pkg-config ];
21
22 buildInputs = [ openssl ];
23
24 meta = with lib; {
25 description = "A tool to compress some state in a Synapse instance's database";
26 homepage = "https://github.com/matrix-org/rust-synapse-compress-state";
27 license = licenses.asl20;
28 maintainers = with maintainers; [ hexa maralorn ];
29 };
30}
diff --git a/overlays/matrix-synapse/1.70.1/tools/synadm.nix b/overlays/matrix-synapse/1.70.1/tools/synadm.nix
new file mode 100644
index 00000000..5075e42e
--- /dev/null
+++ b/overlays/matrix-synapse/1.70.1/tools/synadm.nix
@@ -0,0 +1,47 @@
1{ lib
2, python3Packages
3}:
4
5with python3Packages; buildPythonApplication rec {
6 pname = "synadm";
7 version = "0.36";
8 format = "setuptools";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "sha256-OMXUbfAC927qJw0B5sq1lGJQRkFAUdohIOkCYUbZumI=";
13 };
14
15 postPatch = ''
16 substituteInPlace setup.py \
17 --replace "Click>=7.0,<8.0" "Click"
18 '';
19
20 propagatedBuildInputs = [
21 click
22 click-option-group
23 dnspython
24 tabulate
25 pyyaml
26 requests
27 ];
28
29 checkPhase = ''
30 runHook preCheck
31 export HOME=$TMPDIR
32 $out/bin/synadm -h > /dev/null
33 runHook postCheck
34 '';
35
36 meta = with lib; {
37 description = "Command line admin tool for Synapse";
38 longDescription = ''
39 A CLI tool to help admins of Matrix Synapse homeservers
40 conveniently issue commands available via its admin API's
41 (matrix-org/synapse@master/docs/admin_api)
42 '';
43 homepage = "https://github.com/JOJ0/synadm";
44 license = licenses.gpl3Plus;
45 maintainers = with maintainers; [ hexa ];
46 };
47}
diff --git a/overlays/matrix-synapse/default.nix b/overlays/matrix-synapse/default.nix
new file mode 100644
index 00000000..9db73e35
--- /dev/null
+++ b/overlays/matrix-synapse/default.nix
@@ -0,0 +1,3 @@
1{ final, prev, ... }: {
2 matrix-synapse = final.callPackage ./1.70.1/default.nix {};
3}