Unverified Commit dfdd9bf6 authored by Maximilian Bosch's avatar Maximilian Bosch Committed by GitHub
Browse files

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

parents 519e523d 260fae4d
Loading
Loading
Loading
Loading
+31 −35
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ in
        ...
      }:
      let
        mailserverIP = nodes.mailserver.config.networking.primaryIPAddress;
        mailserverIP = nodes.mailserver.networking.primaryIPAddress;
      in
      {
        services.matrix-synapse = {
@@ -169,11 +169,7 @@ in
      };

    # test mail delivery
    mailserver =
      args:
      let
      in
      {
    mailserver = args: {
      security.pki.certificateFiles = [
        mailerCerts.ca.cert
      ];
+18 −35
Original line number Diff line number Diff line
@@ -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;
  };
}