From 6f434ed48ce3ea9f5458bd58c81c68472a6103fb Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 3 Aug 2021 09:15:31 -0600 Subject: [PATCH 1/4] matrix-synapse: 1.39.0 -> 1.40.0 --- pkgs/servers/matrix-synapse/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix index 982ced37df4b..0b0133082ef3 100644 --- a/pkgs/servers/matrix-synapse/default.nix +++ b/pkgs/servers/matrix-synapse/default.nix @@ -12,11 +12,11 @@ let in buildPythonApplication rec { pname = "matrix-synapse"; - version = "1.39.0"; + version = "1.40.0"; src = fetchPypi { inherit pname version; - sha256 = "sha256-dErfNHDUo0yGLbrRQdwbNkMVfnMfbrO3f7bsRwgRQMM="; + sha256 = "sha256-5RCeKTAtuFERQSoz4WinGz36tMuKtijnupPR/X02hCU="; }; patches = [ From 4444860f074e4530c25217a528748786f9334308 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 3 Aug 2021 09:44:06 -0600 Subject: [PATCH 2/4] matrix-synapse: fix homeserver script --- pkgs/servers/matrix-synapse/default.nix | 18 +++++++++++---- .../matrix-synapse/homeserver-script.patch | 23 ------------------- 2 files changed, 13 insertions(+), 28 deletions(-) delete mode 100644 pkgs/servers/matrix-synapse/homeserver-script.patch diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix index 0b0133082ef3..2f9ceba4f562 100644 --- a/pkgs/servers/matrix-synapse/default.nix +++ b/pkgs/servers/matrix-synapse/default.nix @@ -19,11 +19,6 @@ buildPythonApplication rec { sha256 = "sha256-5RCeKTAtuFERQSoz4WinGz36tMuKtijnupPR/X02hCU="; }; - patches = [ - # adds an entry point for the service - ./homeserver-script.patch - ]; - buildInputs = [ openssl ]; propagatedBuildInputs = [ @@ -70,6 +65,19 @@ buildPythonApplication rec { PYTHONPATH=".:$PYTHONPATH" ${python3.interpreter} -m twisted.trial tests ''; + postFixup = '' + mkdir -p $out/bin + + # Make a little wrapper for running Synapse with its dependencies + echo "#!/bin/sh + exec python -m synapse.app.homeserver \"\$@\" + " > $out/bin/homeserver + chmod +x $out/bin/homeserver + wrapProgram $out/bin/homeserver \ + --set PATH ${python3}/bin \ + --set PYTHONPATH $PYTHONPATH + ''; + passthru.tests = { inherit (nixosTests) matrix-synapse; }; passthru.plugins = plugins; passthru.tools = tools; diff --git a/pkgs/servers/matrix-synapse/homeserver-script.patch b/pkgs/servers/matrix-synapse/homeserver-script.patch deleted file mode 100644 index 554a2c5f66c1..000000000000 --- a/pkgs/servers/matrix-synapse/homeserver-script.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/homeserver b/homeserver -new file mode 120000 -index 000000000..2f1d41351 ---- /dev/null -+++ b/homeserver -@@ -0,0 +1 @@ -+synapse/app/homeserver.py -\ No newline at end of file -diff --git a/setup.py b/setup.py -index 5ce06c898..f1ccd95bc 100755 ---- a/setup.py -+++ b/setup.py -@@ -115,6 +115,6 @@ setup( - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - ], -- scripts=["synctl"] + glob.glob("scripts/*"), -+ scripts=["synctl", "homeserver"] + glob.glob("scripts/*"), - cmdclass={"test": TestCommand}, - ) --- -2.22.0 - From 21eb8c5b37c6bcc18ecd2ebaeaf4a4fabe9c0f36 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 16 Aug 2021 13:01:57 +0200 Subject: [PATCH 3/4] Revert "matrix-synapse: fix homeserver script" This reverts commit 4444860f074e4530c25217a528748786f9334308. --- pkgs/servers/matrix-synapse/default.nix | 18 ++++----------- .../matrix-synapse/homeserver-script.patch | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 pkgs/servers/matrix-synapse/homeserver-script.patch diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix index 2f9ceba4f562..0b0133082ef3 100644 --- a/pkgs/servers/matrix-synapse/default.nix +++ b/pkgs/servers/matrix-synapse/default.nix @@ -19,6 +19,11 @@ buildPythonApplication rec { sha256 = "sha256-5RCeKTAtuFERQSoz4WinGz36tMuKtijnupPR/X02hCU="; }; + patches = [ + # adds an entry point for the service + ./homeserver-script.patch + ]; + buildInputs = [ openssl ]; propagatedBuildInputs = [ @@ -65,19 +70,6 @@ buildPythonApplication rec { PYTHONPATH=".:$PYTHONPATH" ${python3.interpreter} -m twisted.trial tests ''; - postFixup = '' - mkdir -p $out/bin - - # Make a little wrapper for running Synapse with its dependencies - echo "#!/bin/sh - exec python -m synapse.app.homeserver \"\$@\" - " > $out/bin/homeserver - chmod +x $out/bin/homeserver - wrapProgram $out/bin/homeserver \ - --set PATH ${python3}/bin \ - --set PYTHONPATH $PYTHONPATH - ''; - passthru.tests = { inherit (nixosTests) matrix-synapse; }; passthru.plugins = plugins; passthru.tools = tools; diff --git a/pkgs/servers/matrix-synapse/homeserver-script.patch b/pkgs/servers/matrix-synapse/homeserver-script.patch new file mode 100644 index 000000000000..554a2c5f66c1 --- /dev/null +++ b/pkgs/servers/matrix-synapse/homeserver-script.patch @@ -0,0 +1,23 @@ +diff --git a/homeserver b/homeserver +new file mode 120000 +index 000000000..2f1d41351 +--- /dev/null ++++ b/homeserver +@@ -0,0 +1 @@ ++synapse/app/homeserver.py +\ No newline at end of file +diff --git a/setup.py b/setup.py +index 5ce06c898..f1ccd95bc 100755 +--- a/setup.py ++++ b/setup.py +@@ -115,6 +115,6 @@ setup( + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + ], +- scripts=["synctl"] + glob.glob("scripts/*"), ++ scripts=["synctl", "homeserver"] + glob.glob("scripts/*"), + cmdclass={"test": TestCommand}, + ) +-- +2.22.0 + From 5a01d3ac1f1ea31b9b2635eb2ae1d9f6cd860230 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 16 Aug 2021 13:48:00 +0200 Subject: [PATCH 4/4] matrix-synapse: fix startup --- ...tup-add-homeserver-as-console-script.patch | 33 +++++++++++++++++++ pkgs/servers/matrix-synapse/default.nix | 3 +- .../matrix-synapse/homeserver-script.patch | 23 ------------- 3 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 pkgs/servers/matrix-synapse/0001-setup-add-homeserver-as-console-script.patch delete mode 100644 pkgs/servers/matrix-synapse/homeserver-script.patch diff --git a/pkgs/servers/matrix-synapse/0001-setup-add-homeserver-as-console-script.patch b/pkgs/servers/matrix-synapse/0001-setup-add-homeserver-as-console-script.patch new file mode 100644 index 000000000000..eb70d21ed5cb --- /dev/null +++ b/pkgs/servers/matrix-synapse/0001-setup-add-homeserver-as-console-script.patch @@ -0,0 +1,33 @@ +From 36ffbb7ad2c535180cae473b470a43f9db4fbdcd Mon Sep 17 00:00:00 2001 +From: Maximilian Bosch +Date: Mon, 16 Aug 2021 13:27:28 +0200 +Subject: [PATCH] setup: add homeserver as console script + +With this change, it will be added to `$out/bin` in `nixpkgs` directly. +This became necessary since our old workaround, calling it as script, +doesn't work anymore since the shebangs were removed[1]. + +[1] https://github.com/matrix-org/synapse/pull/10415 +--- + setup.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/setup.py b/setup.py +index c47856351..27f1d842c 100755 +--- a/setup.py ++++ b/setup.py +@@ -133,6 +133,11 @@ setup( + long_description=long_description, + long_description_content_type="text/x-rst", + python_requires="~=3.6", ++ entry_points={ ++ 'console_scripts': [ ++ 'homeserver = synapse.app.homeserver:main' ++ ] ++ }, + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Topic :: Communications :: Chat", +-- +2.31.1 + diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix index 0b0133082ef3..4cac9bdcb3fe 100644 --- a/pkgs/servers/matrix-synapse/default.nix +++ b/pkgs/servers/matrix-synapse/default.nix @@ -20,8 +20,7 @@ buildPythonApplication rec { }; patches = [ - # adds an entry point for the service - ./homeserver-script.patch + ./0001-setup-add-homeserver-as-console-script.patch ]; buildInputs = [ openssl ]; diff --git a/pkgs/servers/matrix-synapse/homeserver-script.patch b/pkgs/servers/matrix-synapse/homeserver-script.patch deleted file mode 100644 index 554a2c5f66c1..000000000000 --- a/pkgs/servers/matrix-synapse/homeserver-script.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/homeserver b/homeserver -new file mode 120000 -index 000000000..2f1d41351 ---- /dev/null -+++ b/homeserver -@@ -0,0 +1 @@ -+synapse/app/homeserver.py -\ No newline at end of file -diff --git a/setup.py b/setup.py -index 5ce06c898..f1ccd95bc 100755 ---- a/setup.py -+++ b/setup.py -@@ -115,6 +115,6 @@ setup( - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - ], -- scripts=["synctl"] + glob.glob("scripts/*"), -+ scripts=["synctl", "homeserver"] + glob.glob("scripts/*"), - cmdclass={"test": TestCommand}, - ) --- -2.22.0 -