Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #140979 from Ma27/matrix-workers

nixos/matrix-synapse: minor improvements to implement worker-support

authored by Maximilian Bosch and committed by GitHub cbfe4a42 d86eb3b5

+55 -1
+10
nixos/modules/services/misc/matrix-synapse.nix
··· 122 options = { 123 services.matrix-synapse = { 124 enable = mkEnableOption "matrix.org synapse"; 125 package = mkOption { 126 type = types.package; 127 default = pkgs.matrix-synapse; ··· 705 ''; 706 } 707 ]; 708 709 users.users.matrix-synapse = { 710 group = "matrix-synapse";
··· 122 options = { 123 services.matrix-synapse = { 124 enable = mkEnableOption "matrix.org synapse"; 125 + configFile = mkOption { 126 + type = types.str; 127 + readOnly = true; 128 + description = '' 129 + Path to the configuration file on the target system. Useful to configure e.g. workers 130 + that also need this. 131 + ''; 132 + }; 133 package = mkOption { 134 type = types.package; 135 default = pkgs.matrix-synapse; ··· 713 ''; 714 } 715 ]; 716 + 717 + services.matrix-synapse.configFile = "${configFile}"; 718 719 users.users.matrix-synapse = { 720 group = "matrix-synapse";
+1 -1
pkgs/servers/matrix-synapse/0001-setup-add-homeserver-as-console-script.patch
··· 1 From 36ffbb7ad2c535180cae473b470a43f9db4fbdcd Mon Sep 17 00:00:00 2001 2 From: Maximilian Bosch <maximilian@mbosch.me> 3 Date: Mon, 16 Aug 2021 13:27:28 +0200 4 - Subject: [PATCH] setup: add homeserver as console script 5 6 With this change, it will be added to `$out/bin` in `nixpkgs` directly. 7 This became necessary since our old workaround, calling it as script,
··· 1 From 36ffbb7ad2c535180cae473b470a43f9db4fbdcd Mon Sep 17 00:00:00 2001 2 From: Maximilian Bosch <maximilian@mbosch.me> 3 Date: Mon, 16 Aug 2021 13:27:28 +0200 4 + Subject: [PATCH 1/2] setup: add homeserver as console script 5 6 With this change, it will be added to `$out/bin` in `nixpkgs` directly. 7 This became necessary since our old workaround, calling it as script,
+43
pkgs/servers/matrix-synapse/0002-Expose-generic-worker-as-binary-under-NixOS.patch
···
··· 1 + From 3089758015c64cc1e6788793c4fe40a0e1783457 Mon Sep 17 00:00:00 2001 2 + From: Maximilian Bosch <maximilian@mbosch.me> 3 + Date: Tue, 5 Oct 2021 22:33:12 +0200 4 + Subject: [PATCH 2/2] Expose generic worker as binary under NixOS 5 + 6 + --- 7 + setup.py | 3 ++- 8 + synapse/app/generic_worker.py | 6 +++++- 9 + 2 files changed, 7 insertions(+), 2 deletions(-) 10 + 11 + diff --git a/setup.py b/setup.py 12 + index 27f1d842c..6383aed6f 100755 13 + --- a/setup.py 14 + +++ b/setup.py 15 + @@ -135,7 +135,8 @@ setup( 16 + python_requires="~=3.6", 17 + entry_points={ 18 + 'console_scripts': [ 19 + - 'homeserver = synapse.app.homeserver:main' 20 + + 'homeserver = synapse.app.homeserver:main', 21 + + 'worker = synapse.app.generic_worker:main' 22 + ] 23 + }, 24 + classifiers=[ 25 + diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py 26 + index 3b7131af8..c77a6a95c 100644 27 + --- a/synapse/app/generic_worker.py 28 + +++ b/synapse/app/generic_worker.py 29 + @@ -491,6 +491,10 @@ def start(config_options): 30 + _base.start_worker_reactor("synapse-generic-worker", config) 31 + 32 + 33 + -if __name__ == "__main__": 34 + +def main(): 35 + with LoggingContext("main"): 36 + start(sys.argv[1:]) 37 + + 38 + + 39 + +if __name__ == "__main__": 40 + + main() 41 + -- 42 + 2.31.1 43 +
+1
pkgs/servers/matrix-synapse/default.nix
··· 36 37 patches = [ 38 ./0001-setup-add-homeserver-as-console-script.patch 39 ]; 40 41 buildInputs = [ openssl ];
··· 36 37 patches = [ 38 ./0001-setup-add-homeserver-as-console-script.patch 39 + ./0002-Expose-generic-worker-as-binary-under-NixOS.patch 40 ]; 41 42 buildInputs = [ openssl ];