From 0e9f1e85cd8c6f9d546ef88e971043b909017170 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 7 Nov 2022 20:51:39 +0100 Subject: ... --- overlays/matrix-synapse/1.70.1/default.nix | 111 +++++++++++++++++++++ overlays/matrix-synapse/1.70.1/plugins/default.nix | 8 ++ overlays/matrix-synapse/1.70.1/plugins/ldap3.nix | 17 ++++ .../1.70.1/plugins/mjolnir-antispam.nix | 32 ++++++ overlays/matrix-synapse/1.70.1/plugins/pam.nix | 15 +++ .../1.70.1/plugins/shared-secret-auth.nix | 26 +++++ overlays/matrix-synapse/1.70.1/tools/default.nix | 6 ++ .../1.70.1/tools/rust-synapse-compress-state.nix | 30 ++++++ overlays/matrix-synapse/1.70.1/tools/synadm.nix | 47 +++++++++ overlays/matrix-synapse/default.nix | 3 + 10 files changed, 295 insertions(+) create mode 100644 overlays/matrix-synapse/1.70.1/default.nix create mode 100644 overlays/matrix-synapse/1.70.1/plugins/default.nix create mode 100644 overlays/matrix-synapse/1.70.1/plugins/ldap3.nix create mode 100644 overlays/matrix-synapse/1.70.1/plugins/mjolnir-antispam.nix create mode 100644 overlays/matrix-synapse/1.70.1/plugins/pam.nix create mode 100644 overlays/matrix-synapse/1.70.1/plugins/shared-secret-auth.nix create mode 100644 overlays/matrix-synapse/1.70.1/tools/default.nix create mode 100644 overlays/matrix-synapse/1.70.1/tools/rust-synapse-compress-state.nix create mode 100644 overlays/matrix-synapse/1.70.1/tools/synadm.nix create mode 100644 overlays/matrix-synapse/default.nix (limited to 'overlays/matrix-synapse') 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 @@ +{ lib, stdenv, fetchFromGitHub, python3, openssl, rustPlatform +, enableSystemd ? stdenv.isLinux, nixosTests +, enableRedis ? true +, callPackage +}: + +let + plugins = python3.pkgs.callPackage ./plugins { }; + tools = callPackage ./tools { }; +in +with python3.pkgs; +buildPythonApplication rec { + pname = "matrix-synapse"; + version = "1.70.1"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "matrix-org"; + repo = "synapse"; + rev = "v${version}"; + hash = "sha256-/clEY3sabaDEOAAowQ896vYOvzf5Teevoa7ZkzWw+fY="; + }; + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src; + name = "${pname}-${version}"; + hash = "sha256-9wxWxrn+uPcz60710DROhDqNC6FvTtnqzWiWRk8kl6A="; + }; + + 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 + ''; + + nativeBuildInputs = [ + poetry-core + rustPlatform.cargoSetupHook + setuptools-rust + ] ++ (with rustPlatform.rust; [ + cargo + rustc + ]); + + buildInputs = [ openssl ]; + + propagatedBuildInputs = [ + authlib + bcrypt + bleach + canonicaljson + daemonize + frozendict + ijson + jinja2 + jsonschema + lxml + matrix-common + msgpack + netaddr + phonenumbers + pillow + prometheus-client + psutil + psycopg2 + pyasn1 + pydantic + pyjwt + pymacaroons + pynacl + pyopenssl + pysaml2 + pyyaml + requests + setuptools + signedjson + sortedcontainers + treq + twisted + typing-extensions + unpaddedbase64 + ] ++ lib.optional enableSystemd systemd + ++ lib.optionals enableRedis [ hiredis txredisapi ]; + + checkInputs = [ mock parameterized openssl ]; + + doCheck = !stdenv.isDarwin; + + checkPhase = '' + runHook preCheck + + # remove src module, so tests use the installed module instead + rm -rf ./synapse + + PYTHONPATH=".:$PYTHONPATH" ${python3.interpreter} -m twisted.trial -j $NIX_BUILD_CORES tests + + runHook postCheck + ''; + + passthru.tests = { inherit (nixosTests) matrix-synapse; }; + passthru.plugins = plugins; + passthru.tools = tools; + passthru.python = python3; + + meta = with lib; { + homepage = "https://matrix.org"; + description = "Matrix reference homeserver"; + license = licenses.asl20; + maintainers = teams.matrix.members; + }; +} 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 @@ +{ callPackage }: + +{ + matrix-synapse-ldap3 = callPackage ./ldap3.nix { }; + matrix-synapse-mjolnir-antispam = callPackage ./mjolnir-antispam.nix { }; + matrix-synapse-pam = callPackage ./pam.nix { }; + matrix-synapse-shared-secret-auth = callPackage ./shared-secret-auth.nix { }; +} 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 @@ +{ isPy3k, buildPythonPackage, fetchPypi, service-identity, ldap3, twisted, ldaptor, mock }: + +buildPythonPackage rec { + pname = "matrix-synapse-ldap3"; + version = "0.1.5"; + + src = fetchPypi { + inherit pname version; + sha256 = "9fdf8df7c8ec756642aa0fea53b31c0b2f1924f70d7f049a2090b523125456fe"; + }; + + propagatedBuildInputs = [ service-identity ldap3 twisted ]; + + # ldaptor is not ready for py3 yet + doCheck = !isPy3k; + checkInputs = [ ldaptor mock ]; +} 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 @@ +{ lib, buildPythonPackage, fetchFromGitHub, matrix-synapse }: + +buildPythonPackage rec { + pname = "matrix-synapse-mjolnir-antispam"; + version = "1.5.0"; + + src = fetchFromGitHub { + owner = "matrix-org"; + repo = "mjolnir"; + rev = "refs/tags/v${version}"; + sha256 = "sha256-YmP+r9W5e63Aw66lSQeTTbYwSF/vjPyHkoehJxtcRNw="; + }; + + sourceRoot = "./source/synapse_antispam"; + + propagatedBuildInputs = [ matrix-synapse ]; + + doCheck = false; # no tests + pythonImportsCheck = [ "mjolnir" ]; + + meta = with lib; { + description = "AntiSpam / Banlist plugin to be used with mjolnir"; + longDescription = '' + Primarily meant to block invites from undesired homeservers/users, + Mjolnir's Synapse module is a way to interpret ban lists and apply + them to your entire homeserver. + ''; + homepage = "https://github.com/matrix-org/mjolnir#synapse-module"; + license = licenses.asl20; + maintainers = with maintainers; [ jojosch ]; + }; +} 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 @@ +{ buildPythonPackage, fetchFromGitHub, twisted, python-pam }: + +buildPythonPackage rec { + pname = "matrix-synapse-pam"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "14mRh4X0r"; + repo = "matrix-synapse-pam"; + rev = "v${version}"; + sha256 = "0jgz49cwiyih5cg3hr4byva04zjnq8aj7rima9874la9fc5sd2wf"; + }; + + propagatedBuildInputs = [ twisted python-pam ]; +} 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 @@ +{ lib, buildPythonPackage, fetchFromGitHub, matrix-synapse, twisted }: + +buildPythonPackage rec { + pname = "matrix-synapse-shared-secret-auth"; + version = "2.0.2"; + + src = fetchFromGitHub { + owner = "devture"; + repo = "matrix-synapse-shared-secret-auth"; + rev = version; + sha256 = "sha256-qzXKwTEOMtdvsxoU3Xh3vQyhK+Q18LfkeSts7EyDIXE="; + }; + + doCheck = false; + pythonImportsCheck = [ "shared_secret_authenticator" ]; + + buildInputs = [ matrix-synapse ]; + propagatedBuildInputs = [ twisted ]; + + meta = with lib; { + description = "Shared Secret Authenticator password provider module for Matrix Synapse"; + homepage = "https://github.com/devture/matrix-synapse-shared-secret-auth"; + license = licenses.agpl3Plus; + maintainers = with maintainers; [ sumnerevans ]; + }; +} 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 @@ +{ callPackage }: +{ + rust-synapse-compress-state = callPackage ./rust-synapse-compress-state.nix { }; + + synadm = callPackage ./synadm.nix { }; +} 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 @@ +{ lib, rustPlatform, python3, fetchFromGitHub, pkg-config, openssl }: + +rustPlatform.buildRustPackage rec { + pname = "rust-synapse-compress-state"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "matrix-org"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-SSfVtG8kwHarVbB1O7xC2SSbUpPGYMHTMyoxu8mpEk0="; + }; + + cargoSha256 = "sha256-PG+UeovhJMsIlm5dOYdtMxbUxZjwG3V59kAcB9aFP5c="; + + cargoBuildFlags = [ + "--all" + ]; + + nativeBuildInputs = [ python3 pkg-config ]; + + buildInputs = [ openssl ]; + + meta = with lib; { + description = "A tool to compress some state in a Synapse instance's database"; + homepage = "https://github.com/matrix-org/rust-synapse-compress-state"; + license = licenses.asl20; + maintainers = with maintainers; [ hexa maralorn ]; + }; +} 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 @@ +{ lib +, python3Packages +}: + +with python3Packages; buildPythonApplication rec { + pname = "synadm"; + version = "0.36"; + format = "setuptools"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-OMXUbfAC927qJw0B5sq1lGJQRkFAUdohIOkCYUbZumI="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace "Click>=7.0,<8.0" "Click" + ''; + + propagatedBuildInputs = [ + click + click-option-group + dnspython + tabulate + pyyaml + requests + ]; + + checkPhase = '' + runHook preCheck + export HOME=$TMPDIR + $out/bin/synadm -h > /dev/null + runHook postCheck + ''; + + meta = with lib; { + description = "Command line admin tool for Synapse"; + longDescription = '' + A CLI tool to help admins of Matrix Synapse homeservers + conveniently issue commands available via its admin API's + (matrix-org/synapse@master/docs/admin_api) + ''; + homepage = "https://github.com/JOJ0/synadm"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ hexa ]; + }; +} 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 @@ +{ final, prev, ... }: { + matrix-synapse = final.callPackage ./1.70.1/default.nix {}; +} -- cgit v1.2.3