Merge: matrix-synapse-unwrapped: clean up (#434352)

This commit is contained in:
Maximilian Bosch
2025-08-24 01:06:14 +02:00
committed by GitHub
2 changed files with 46 additions and 67 deletions
+28 -32
View File
@@ -67,7 +67,7 @@ in
...
}:
let
mailserverIP = nodes.mailserver.config.networking.primaryIPAddress;
mailserverIP = nodes.mailserver.networking.primaryIPAddress;
in
{
services.matrix-synapse = {
@@ -169,44 +169,40 @@ in
};
# test mail delivery
mailserver =
args:
let
in
{
security.pki.certificateFiles = [
mailerCerts.ca.cert
];
mailserver = args: {
security.pki.certificateFiles = [
mailerCerts.ca.cert
];
networking.firewall.enable = false;
networking.firewall.enable = false;
services.postfix = {
enable = true;
enableSubmission = true;
services.postfix = {
enable = true;
enableSubmission = true;
# blackhole transport
transport = "example.com discard:silently";
# blackhole transport
transport = "example.com discard:silently";
settings.main = {
myhostname = "${mailerDomain}";
# open relay for subnet
mynetworks_style = "subnet";
debug_peer_level = "10";
smtpd_relay_restrictions = [
"permit_mynetworks"
"reject_unauth_destination"
];
settings.main = {
myhostname = "${mailerDomain}";
# open relay for subnet
mynetworks_style = "subnet";
debug_peer_level = "10";
smtpd_relay_restrictions = [
"permit_mynetworks"
"reject_unauth_destination"
];
# disable obsolete protocols, something old versions of twisted are still using
smtpd_tls_protocols = "TLSv1.3, TLSv1.2, !TLSv1.1, !TLSv1, !SSLv2, !SSLv3";
smtpd_tls_mandatory_protocols = "TLSv1.3, TLSv1.2, !TLSv1.1, !TLSv1, !SSLv2, !SSLv3";
smtpd_tls_chain_files = [
"${mailerCerts.${mailerDomain}.key}"
"${mailerCerts.${mailerDomain}.cert}"
];
};
# disable obsolete protocols, something old versions of twisted are still using
smtpd_tls_protocols = "TLSv1.3, TLSv1.2, !TLSv1.1, !TLSv1, !SSLv2, !SSLv3";
smtpd_tls_mandatory_protocols = "TLSv1.3, TLSv1.2, !TLSv1.1, !TLSv1, !SSLv2, !SSLv3";
smtpd_tls_chain_files = [
"${mailerCerts.${mailerDomain}.key}"
"${mailerCerts.${mailerDomain}.cert}"
];
};
};
};
serversqlite = args: {
services.matrix-synapse = {
@@ -2,8 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
python3,
python3Packages,
openssl,
libiconv,
cargo,
@@ -13,10 +12,7 @@
nix-update-script,
}:
let
plugins = python3.pkgs.callPackage ./plugins { };
in
python3.pkgs.buildPythonApplication rec {
python3Packages.buildPythonApplication rec {
pname = "matrix-synapse";
version = "1.136.0";
format = "pyproject";
@@ -33,29 +29,13 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-GX4lVg6aPVlqFgSSGsUg3wi7bne9jVWPTVx8rO5SjL8=";
};
postPatch = ''
# Remove setuptools_rust from runtime dependencies
# https://github.com/element-hq/synapse/blob/v1.69.0/pyproject.toml#L177-L185
sed -i '/^setuptools_rust =/d' pyproject.toml
# Remove version pin on build dependencies. Upstream does this on purpose to
# be extra defensive, but we don't want to deal with updating this
sed -i 's/"poetry-core>=\([0-9.]*\),<=[0-9.]*"/"poetry-core>=\1"/' pyproject.toml
sed -i 's/"setuptools_rust>=\([0-9.]*\),<=[0-9.]*"/"setuptools_rust>=\1"/' pyproject.toml
# Don't force pillow to be 10.0.1 because we already have patched it, and
# we don't use the pillow wheels.
sed -i 's/Pillow = ".*"/Pillow = ">=5.4.0"/' pyproject.toml
# https://github.com/element-hq/synapse/pull/17878#issuecomment-2575412821
substituteInPlace tests/storage/databases/main/test_events_worker.py \
--replace-fail "def test_recovery" "def no_test_recovery"
'';
nativeBuildInputs = with python3.pkgs; [
build-system = with python3Packages; [
poetry-core
rustPlatform.cargoSetupHook
setuptools-rust
];
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
];
@@ -67,8 +47,10 @@ python3.pkgs.buildPythonApplication rec {
libiconv
];
propagatedBuildInputs =
with python3.pkgs;
pythonRemoveDeps = [ "setuptools_rust" ];
dependencies =
with python3Packages;
[
attrs
bcrypt
@@ -103,7 +85,7 @@ python3.pkgs.buildPythonApplication rec {
]
++ twisted.optional-dependencies.tls;
optional-dependencies = with python3.pkgs; {
optional-dependencies = with python3Packages; {
postgres =
if isPyPy then
[
@@ -143,11 +125,11 @@ python3.pkgs.buildPythonApplication rec {
nativeCheckInputs = [
openssl
]
++ (with python3.pkgs; [
++ (with python3Packages; [
mock
parameterized
])
++ builtins.filter (p: !p.meta.broken) (lib.flatten (lib.attrValues optional-dependencies));
++ lib.filter (pkg: !pkg.meta.broken) (lib.flatten (lib.attrValues optional-dependencies));
doCheck = !stdenv.hostPlatform.isDarwin;
@@ -164,15 +146,15 @@ python3.pkgs.buildPythonApplication rec {
NIX_BUILD_CORES=4
fi
PYTHONPATH=".:$PYTHONPATH" ${python3.interpreter} -m twisted.trial -j $NIX_BUILD_CORES tests
PYTHONPATH=".:$PYTHONPATH" ${python3Packages.python.interpreter} -m twisted.trial -j $NIX_BUILD_CORES tests
runHook postCheck
'';
passthru = {
tests = { inherit (nixosTests) matrix-synapse matrix-synapse-workers; };
inherit plugins;
python = python3;
plugins = python3Packages.callPackage ./plugins { };
inherit (python3Packages) python;
updateScript = nix-update-script { };
};
@@ -183,5 +165,6 @@ python3.pkgs.buildPythonApplication rec {
license = lib.licenses.agpl3Plus;
maintainers = with lib.maintainers; [ sumnerevans ];
teams = [ lib.teams.matrix ];
platforms = lib.platforms.linux;
};
}