anchor.diff: -{ stdenv, python2Packages, fetchurl, fetchFromGitHub }:
  +{ lib, stdenv, python2Packages, fetchurl, fetchFromGitHub
  +, enableSystemd ? true
  +}:
   let
     matrix-angular-sdk = python2Packages.buildPythonPackage rec {
       name = "matrix-angular-sdk-${version}";
  
positive.code:   };
  in python2Packages.buildPythonApplication rec {
    name = "matrix-synapse-${version}";
    version = "0.33.6";
  
    src = fetchFromGitHub {
      owner = "matrix-org";
      repo = "synapse";
      rev = "v${version}";
      sha256 = "0c1dr09f1msv6xvpmdlncx7yyj6qxnpihd93lqckd115fds12g5h";
    };
  
    patches = [
  
negative.code:   ];
  
    propagatedBuildInputs = with python2Packages; [
      bcrypt
      bleach
      canonicaljson
      daemonize
      dateutil
      frozendict
      jinja2
      jsonschema
      lxml
      matrix-angular-sdk
      matrix-synapse-ldap3
      msgpack-python
      netaddr
      phonenumbers
      pillow
      prometheus_client
      psutil
      psycopg2
      pyasn1
      pydenticon
      pymacaroons-pynacl
      pynacl
      pyopenssl
      pysaml2
      pyyaml
      requests
      signedjson
      sortedcontainers
      treq
      twisted
      unpaddedbase64
    ] ++ lib.optional enableSystemd systemd;
  
    doCheck = true;
    checkPhase = "python -m twisted.trial test";
  
    buildInputs = with python2Packages; [
      mock setuptoolsTrial
  