Subject: [bug#39841] [WIP PATCH] synapse

From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 13:12:44 -0600

This patch series is the same as the last but cleaned up according to
guix lint.

>From 965546778c1824eb7efe90c02ffc6878a1ed907e Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Thu, 19 Dec 2019 20:43:34 -0500
Subject: [PATCH] gnu: Add emacs-punpun-theme.

* gnu/packages/emacs-xyz.scm (emacs-punpun-theme): New variable.
---
 gnu/packages/emacs-xyz.scm | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 8ff7a23f51..45636f87f9 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -19876,6 +19876,31 @@ is cast on a light backdrop (Modus Operandi) and another where light text is
 displayed against a dark background (Modus Vivendi).")
     (license license:gpl3+)))
 
+(define-public emacs-punpun-theme
+  (let ((commit "2f78125609277b2478abdebd8f9d5ee10a823b65")
+        (revision "0"))
+    (package
+      (name "emacs-punpun-theme")
+      (version (git-version "0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/wasamasa/punpun-theme.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1sgxrj3igzq86h3whfymxf4qzv9kpvcrlhbvjmnp7fwrplys0n7d"))))
+      (build-system emacs-build-system)
+      (home-page "https://github.com/wasamasa/punpun-theme")
+      (synopsis "Bleak Emacs theme")
+      (description
+       "A bleak theme.  Uses shades of gray and the occasional splash of
+color.  Designed for 256-color terminals.  Comes in light and dark!")
+      (license license:gpl3+))))
+
+
 (define-public emacs-elixir-mode
   (package
     (name "emacs-elixir-mode")
-- 
2.24.1

>From 5156cfff4e0e9c8b7223213ab28c891c97641e6c Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 7 Sep 2019 16:18:38 -0500
Subject: [PATCH] gnu: Add fennel.

* gnu/packages/fennel.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add fennel.scm.
---
 gnu/local.mk            |  1 +
 gnu/packages/fennel.scm | 63 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 gnu/packages/fennel.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index b7a5ef825b..84bfc8df2c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -176,6 +176,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/erlang.scm			\
   %D%/packages/fabric-management.scm		\
   %D%/packages/fcitx.scm			\
+  %D%/packages/fennel.scm			\
   %D%/packages/figlet.scm			\
   %D%/packages/file.scm				\
   %D%/packages/file-systems.scm			\
diff --git a/gnu/packages/fennel.scm b/gnu/packages/fennel.scm
new file mode 100644
index 0000000000..0bce77fa66
--- /dev/null
+++ b/gnu/packages/fennel.scm
@@ -0,0 +1,63 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Alex ter Weele <[email-masked]>
+
+(define-module (gnu packages fennel)
+  #:use-module (gnu packages lua)
+  #:use-module (guix packages)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix git-download)
+  #:use-module ((guix licenses) #:prefix license:))
+
+(define-public fennel
+  (package
+    (name "fennel")
+    (version "0.3.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/bakpakin/Fennel.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1d5kzgb9l2gdya1jqvp4ni03rd8v270fbhy5wxkjbhr9xf2xb14k"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda _
+             (let* ((out (assoc-ref %outputs "out"))
+                    (data (string-append out "/share/"))
+                    (bin (string-append out "/bin/")))
+               (copy-recursively (assoc-ref %build-inputs "source") data)
+               (install-file "fennel" bin)
+               (wrap-program (string-append bin "fennel")
+                 `("LUA_PATH" ";" prefix (,(string-append data "?.lua")))
+                 `("FENNEL_PATH" ";" prefix (,(string-append data "?.fnl"))))))))))
+    (inputs
+     `(("lua" ,lua)))
+    (home-page "https://fennel-lang.org/")
+    (synopsis "Lua lisp language")
+    (description "Fennel is a programming language that brings together the
+speed, simplicity, and reach of Lua with the flexibility of a lisp syntax and
+macro system.
+
+    * Full Lua compatibility: Easily call any Lua function or library from
+Fennel and vice-versa.
+
+    * Zero overhead: Compiled code should be just as or more efficient than
+hand-written Lua.
+
+    * Compile-time macros: Ship compiled code with no runtime dependency on
+Fennel.
+
+    * Embeddable: Fennel is a one-file library as well as an executable.
+Embed it in other programs to support runtime extensibility and interactive
+development.
+
+Anywhere you can run Lua code, you can run Fennel code.")
+    (license license:x11)))
-- 
2.23.0

>From 713a8bf6905ccd49ff53a5a06526816ca0a98535 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:03:02 -0600
Subject: [PATCH 01/12] gnu: python-typing-extensions: Update to 3.7.4.1.

* gnu/packages/python-xyz (python-typing-extensions): Update to 3.7.4.1.
---
 gnu/packages/python-xyz.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 4ea09b756e..abd3ff775a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -14907,14 +14907,14 @@ and other tools.")
 (define-public python-typing-extensions
   (package
     (name "python-typing-extensions")
-    (version "3.7.2")
+    (version "3.7.4.1")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "typing_extensions" version))
        (sha256
         (base32
-         "0wfsv71pvkyf2na938l579jh0v3kzl6g744ijgnahcwd4d9x0b7v"))))
+         "1wj1vcgbnm20aiinmphyxfrbv3qi9xdhvw89ab3qm42y9n4wq7h9"))))
     (build-system python-build-system)
     (home-page
      "https://github.com/python/typing/blob/master/typing_extensions/README.rst")
-- 
2.25.1

>From d53f6249c0b1adf07f850b65c08bfefc9951bae9 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:06:27 -0600
Subject: [PATCH 02/12] gnu: Add python-frozendict.

* gnu/packages/python-xyz.scm (python-frozendict): New variable.
---
 gnu/packages/python-xyz.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index abd3ff775a..6dfa16cc67 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17576,3 +17576,22 @@ sequences.")
 
 (define-public python2-fuzzywuzzy
   (package-with-python2 python-fuzzywuzzy))
+
+(define-public python-frozendict
+  (package
+    (name "python-frozendict")
+    (version "1.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "frozendict" version))
+       (sha256
+        (base32 "0ibf1wipidz57giy53dh7mh68f2hz38x8f4wdq88mvxj5pr7jhbp"))))
+    (build-system python-build-system)
+    (home-page "https://github.com/slezica/python-frozendict")
+    (synopsis "Simple immutable mapping for Python")
+    (description
+     "@dfn{frozendict} is an immutable wrapper around dictionaries that
+implements the complete mapping interface.  It can be used as a drop-in
+replacement for dictionaries where immutability is desired.")
+    (license license:expat)))
-- 
2.25.1

>From e3571a4a5229026c4bd3c12632056239adfca9f2 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:07:34 -0600
Subject: [PATCH 03/12] gnu: Add python-unpaddedbase64.

* gnu/packages/python-xyz.scm (python-unpaddedbase64): New variable.
---
 gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6dfa16cc67..20cd3d78a9 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17595,3 +17595,26 @@ sequences.")
 implements the complete mapping interface.  It can be used as a drop-in
 replacement for dictionaries where immutability is desired.")
     (license license:expat)))
+
+(define-public python-unpaddedbase64
+  (package
+    (name "python-unpaddedbase64")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/matrix-org/python-unpaddedbase64.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0if3fjfxga0bwdq47v77fs9hrcqpmwdxry2i2a7pdqsp95258nxd"))))
+    (build-system python-build-system)
+    (home-page "https://pypi.org/project/unpaddedbase64/")
+    (synopsis "Encode and decode Base64 without “=” padding")
+    (description
+     "RFC 4648 specifies that Base64 should be padded to a multiple of 4 bytes
+using “=” characters.  However this conveys no benefit so many protocols
+choose to use Base64 without the “=” padding.")
+    (license license:asl2.0)))
-- 
2.25.1

>From 3302ceb0ba579a346e66ed29b14d6a0e2e8b7d1e Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:08:29 -0600
Subject: [PATCH 04/12] gnu: Add python-canonicaljson.

* gnu/packages/python-xyz.scm (python-canonicaljson): New variable.
---
 gnu/packages/python-xyz.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 20cd3d78a9..1d7b850b1d 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17618,3 +17618,35 @@ replacement for dictionaries where immutability is desired.")
 using “=” characters.  However this conveys no benefit so many protocols
 choose to use Base64 without the “=” padding.")
     (license license:asl2.0)))
+
+(define-public python-canonicaljson
+  (package
+    (name "python-canonicaljson")
+    (version "1.1.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "canonicaljson" version))
+       (sha256
+        (base32 "09cpacc8yvcc74i63pdmlfaahh77dnvbyw9zf29wml2zzwqfbg25"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-six" ,python-six)
+       ("python-frozendict" ,python-frozendict)
+       ("python-simplejson" ,python-simplejson)))
+    (home-page "https://github.com/matrix-org/python-canonicaljson")
+    (synopsis "Canonical JSON")
+    (description
+     "Deterministically encode JSON.
+
+@enumerate
+@item Encodes objects and arrays as RFC 7159 JSON.
+@item Sorts object keys so that you get the same result each time.
+@item Has no insignificant whitespace to make the output as small as possible.
+@item Escapes only the characters that must be escaped, U+0000 to
+ U+0019 / U+0022 / U+0056, to keep the output as small as possible.
+@item Uses the shortest escape sequence for each escaped character.
+@item Encodes the JSON as UTF-8.
+@item Can encode frozendict immutable dictionaries.
+@end enumerate ")
+    (license license:asl2.0)))
-- 
2.25.1

>From 21f226843fda4770fdef04cf9824525376e2b33b Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:09:58 -0600
Subject: [PATCH 05/12] gnu: Add python-signedjson.

* gnu/packages/python-xyz.scm (python-signedjson): New variable.
---
 gnu/packages/python-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 1d7b850b1d..3b8210e54f 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17650,3 +17650,42 @@ choose to use Base64 without the “=” padding.")
 @item Can encode frozendict immutable dictionaries.
 @end enumerate ")
     (license license:asl2.0)))
+
+(define-public python-signedjson
+  (package
+    (name "python-signedjson")
+    (version "1.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "signedjson" version))
+       (sha256
+        (base32 "13wfi50wzz38j6xsz7hmx26vf0zvk0fj7516wavzpsyfk9xy3g5v"))))
+    (build-system python-build-system)
+    (arguments
+     ;; TODO "AttributeError: type object 'Callable' has no attribute
+     ;; '_abc_registry'"
+     `(#:tests? #f))
+    (inputs
+     `(("python-canonicaljson" ,python-canonicaljson)
+       ("python-unpaddedbase64" ,python-unpaddedbase64)
+       ("python-pynacl" ,python-pynacl)
+       ("python-typing-extensions" ,python-typing-extensions)
+       ("python-typing" ,python-typing)))
+    (native-inputs
+     `(("python-simplejson" ,python-simplejson)
+       ("python-frozendict" ,python-frozendict)))
+    (home-page "https://github.com/matrix-org/python-signedjson")
+    (synopsis "Sign JSON objects with ED25519 signatures")
+    (description
+     "Sign JSON objects with ED25519 signatures.
+
+@enumerate
+@item More than one entity can sign the same object.
+@item Each entity can sign the object with more than one key making it easier to
+rotate keys
+@item ED25519 can be replaced with a different algorithm.
+@item Unprotected data can be added to the object under the @dfn{\"unsigned\"}
+key.
+@end enumerate")
+    (license license:asl2.0)))
-- 
2.25.1

>From 2b3849e4e806f78e05f1bb4a7f4df585442b6aa7 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:10:35 -0600
Subject: [PATCH 06/12] gnu: Add python-daemonize.

* gnu/packages/python-xyz.scm (python-daemonize): New variable.
---
 gnu/packages/python-xyz.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 3b8210e54f..8506e47e26 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17689,3 +17689,19 @@ rotate keys
 key.
 @end enumerate")
     (license license:asl2.0)))
+
+(define-public python-daemonize
+  (package
+    (name "python-daemonize")
+    (version "2.5.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "daemonize" version))
+       (sha256
+        (base32 "1hwbl3gf9fdds9sc14zgjyjisjvxidrvqc11xlbb0b6jz17nw0nx"))))
+    (build-system python-build-system)
+    (home-page "https://github.com/thesharp/daemonize")
+    (synopsis "Library for writing system daemons in Python")
+    (description "Daemonize is a library for writing system daemons in Python.")
+    (license license:expat)))
-- 
2.25.1

>From 3deff6285a2a24059378b9b7a0248f2dbd96176e Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:11:11 -0600
Subject: [PATCH 07/12] gnu: Add python-pymacaroons.

* gnu/packages/python-xyz.scm (python-pymacaroons): New variable.
---
 gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 8506e47e26..dd100dd1c6 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17705,3 +17705,30 @@ key.
     (synopsis "Library for writing system daemons in Python")
     (description "Daemonize is a library for writing system daemons in Python.")
     (license license:expat)))
+
+(define-public python-pymacaroons
+  (package
+    (name "python-pymacaroons")
+    (version "0.13.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pymacaroons" version))
+       (sha256
+        (base32 "1f0357a6g1h96sk6wy030xmc1p4rd80a999qvxd28v7nlm1blsqy"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-six" ,python-six)
+       ("python-pynacl" ,python-pynacl)))
+    (home-page "https://github.com/ecordell/pymacaroons")
+    (synopsis "Python Macaroon Library")
+    (description
+     "Macaroons, like cookies, are a form of bearer credential.  Unlike opaque
+tokens, macaroons embed caveats that define specific authorization
+requirements for the target service, the service that issued the root macaroon
+and which is capable of verifying the integrity of macaroons it receives.
+
+Macaroons allow for delegation and attenuation of authorization.  They are
+simple and fast to verify, and decouple authorization policy from the
+enforcement of that policy.")
+    (license license:expat)))
-- 
2.25.1

>From 34a1fd90d996608ae33fab3f91b28f81e0c83d99 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:11:35 -0600
Subject: [PATCH 08/12] gnu: Add python-prometheus-client.

* gnu/packages/python-xyz.scm (python-prometheus-client): New variable.
---
 gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index dd100dd1c6..d054b3ef60 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17732,3 +17732,26 @@ Macaroons allow for delegation and attenuation of authorization.  They are
 simple and fast to verify, and decouple authorization policy from the
 enforcement of that policy.")
     (license license:expat)))
+
+(define-public python-prometheus-client
+  (package
+    (name "python-prometheus-client")
+    (version "0.7.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "prometheus_client" version))
+       (sha256
+        (base32 "1ni2yv4ixwz32nz39ckia76lvggi7m19y5f702w5qczbnfi29kbi"))))
+    (build-system python-build-system)
+    (arguments
+     ;; TODO "ModuleNotFoundError: No module named 'tests'"
+     `(#:tests? #f))
+    (inputs
+     `(("python-twisted" ,python-twisted)))
+    (native-inputs
+     `(("python-tox" ,python-tox)))
+    (home-page "https://github.com/prometheus/client_python")
+    (synopsis "Prometheus instrumentation library for Python applications")
+    (description "The official Python 2 and 3 client for Prometheus.")
+    (license license:asl2.0)))
-- 
2.25.1

>From e9bc8cab5e24476e9074c1d77a11342ec5b17453 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:12:08 -0600
Subject: [PATCH 09/12] gnu: Add python-ldap3.

* gnu/packages/python-xyz.scm (python-ldap3): New variable.
---
 gnu/packages/python-xyz.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d054b3ef60..3f4e6c0d68 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17755,3 +17755,27 @@ enforcement of that policy.")
     (synopsis "Prometheus instrumentation library for Python applications")
     (description "The official Python 2 and 3 client for Prometheus.")
     (license license:asl2.0)))
+
+(define-public python-ldap3
+  (package
+    (name "python-ldap3")
+    (version "2.6.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "ldap3" version))
+       (sha256
+        (base32 "0ag5xqlki6pjk3f50b8ar8vynx2fmkna7rfampv3kdgwg8z6gjr7"))))
+    (build-system python-build-system)
+    (arguments
+     ;; TODO "ImportError: Failed to import test module: ordDict"
+     `(#:tests? #f))
+    (inputs
+     `(("python-pyasn1" ,python-pyasn1)
+       ("python-gssapi" ,python-gssapi)))
+    (home-page "https://github.com/cannatag/ldap3")
+    (synopsis "Strictly RFC 4510 conforming LDAP V3 pure Python client")
+    (description
+     "LDAP3 is a strictly RFC 4510 conforming LDAP V3 pure Python client
+library.  The same codebase runs in Python 2, Python 3, PyPy and PyPy3.")
+    (license license:lgpl3+)))
-- 
2.25.1

>From 365c26db7babe3a1aca1d50740001aa071c0bdb9 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:13:26 -0600
Subject: [PATCH 10/12] gnu: Add python-txacme.

* gnu/packages/python-xyz.scm (python-txacme): New variable.
---
 gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 3f4e6c0d68..8d197d73ba 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17779,3 +17779,30 @@ enforcement of that policy.")
      "LDAP3 is a strictly RFC 4510 conforming LDAP V3 pure Python client
 library.  The same codebase runs in Python 2, Python 3, PyPy and PyPy3.")
     (license license:lgpl3+)))
+
+(define-public python-txacme
+  (package
+    (name "python-txacme")
+    (version "0.9.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "txacme" version))
+       (sha256
+        (base32 "1cplx4llq7i508w6fgwjdv9di7rsz9k9irfmzdfbiz6q6a0ykf1d"))))
+    (build-system python-build-system)
+    (inputs
+     ;; TODO many unpackaged inputs needed
+     `())
+    (home-page "https://github.com/twisted/txacme")
+    (synopsis
+     "Twisted implementation of the ACME protocol")
+    (description
+     "ACME is Automatic Certificate Management Environment, a protocol that
+allows clients and certificate authorities to automate verification and
+certificate issuance.  The ACME protocol is used by the free Let's Encrypt
+Certificate Authority.
+
+txacme is an implementation of the protocol for Twisted, the event-driven
+networking engine for Python.")
+    (license license:expat)))
-- 
2.25.1

>From 8a7ae34ff4712ef8abb055c4807517f27af0eb06 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:19:28 -0600
Subject: [PATCH 11/12] gnu: Add python-matrix-synapse-ldap3.

* gnu/packages/matrix.scm: New file. (python-matrix-synapse-ldap3) New
  variable.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add matrix.scm.
---
 gnu/local.mk            |  1 +
 gnu/packages/matrix.scm | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 gnu/packages/matrix.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 857345cfad..5c87561eaf 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -340,6 +340,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/marst.scm			\
   %D%/packages/mate.scm             \
   %D%/packages/maths.scm			\
+  %D%/packages/matrix.scm			\
   %D%/packages/maven.scm			\
   %D%/packages/mc.scm				\
   %D%/packages/mcrypt.scm			\
diff --git a/gnu/packages/matrix.scm b/gnu/packages/matrix.scm
new file mode 100644
index 0000000000..3d83195c82
--- /dev/null
+++ b/gnu/packages/matrix.scm
@@ -0,0 +1,33 @@
+(define-module (gnu packages matrix)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages python-crypto)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (guix build-system python)
+  #:use-module (guix download)
+  #:use-module (guix packages))
+
+(define-public python-matrix-synapse-ldap3
+  (package
+    (name "python-matrix-synapse-ldap3")
+    (version "0.1.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "matrix-synapse-ldap3" version))
+       (sha256
+        (base32
+         "01bms89sl16nyh9f141idsz4mnhxvjrc3gj721wxh1fhikps0djx"))))
+    (build-system python-build-system)
+    (arguments
+     ;; tests require synapse, creating a circular dependency.
+     '(#:tests? #f))
+    (inputs
+     `(("python-twisted" ,python-twisted)
+       ("python-ldap3" ,python-ldap3)
+       ("python-service-identity" ,python-service-identity)))
+    (home-page "https://github.com/matrix-org/matrix-synapse-ldap3")
+    (synopsis "LDAP3 auth provider for Synapse")
+    (description
+     "Allows synapse to use LDAP as a password provider.  This allows users to
+log in to synapse with their username and password from an LDAP server.")
+    (license license:asl2.0)))
-- 
2.25.1

>From 705608cab6b94d3242686b18331d865257f2a751 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <[email-masked]>
Date: Sat, 29 Feb 2020 11:22:06 -0600
Subject: [PATCH 12/12] gnu: Add synapse.

* gnu/packages/matrix.scm (synapse): New variable.
---
 gnu/packages/matrix.scm | 67 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/gnu/packages/matrix.scm b/gnu/packages/matrix.scm
index 3d83195c82..d74ce6f430 100644
--- a/gnu/packages/matrix.scm
+++ b/gnu/packages/matrix.scm
@@ -1,7 +1,11 @@
 (define-module (gnu packages matrix)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages check)
+  #:use-module (gnu packages databases)
   #:use-module (gnu packages python-crypto)
+  #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages xml)
   #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix packages))
@@ -31,3 +35,66 @@
      "Allows synapse to use LDAP as a password provider.  This allows users to
 log in to synapse with their username and password from an LDAP server.")
     (license license:asl2.0)))
+
+(define-public synapse
+  (package
+    (name "synapse")
+    (version "1.11.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "matrix-synapse" version))
+              (sha256
+               (base32
+                "0cqbwcz0fi4w413s1kcxvf696qi4n46n1k4ggnygqri5yq26qlfy"))))
+    (build-system python-build-system)
+    ;; TODO I think there are custom tests
+    (inputs
+     `(("python-simplejson" ,python-simplejson) ; not attested but required
+       ;; requirements (synapse/python_dependencies.py)
+       ("python-jsonschema" ,python-jsonschema)
+       ("python-frozendict" ,python-frozendict)
+       ("python-unpaddedbase64" ,python-unpaddedbase64)
+       ("python-canonicaljson" ,python-canonicaljson)
+       ("python-signedjson" ,python-signedjson)
+       ("python-pynacl" ,python-pynacl)
+       ("python-idna" ,python-idna)
+       ("python-service-identity" ,python-service-identity)
+       ("python-twisted" ,python-twisted)
+       ("python-treq" ,python-treq)
+       ("python-pyopenssl" ,python-pyopenssl)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-pyasn1" ,python-pyasn1)
+       ("python-pyasn1-modules" ,python-pyasn1-modules)
+       ("python-daemonize" ,python-daemonize)
+       ("python-bcrypt" ,python-bcrypt)
+       ("python-pillow" ,python-pillow)
+       ("python-sortedcontainers" ,python-sortedcontainers)
+       ("python-pymacaroons" ,python-pymacaroons)
+       ("python-msgpack" ,python-msgpack)
+       ("python-phonenumbers" ,python-phonenumbers)
+       ("python-six" ,python-six)
+       ("python-prometheus-client" ,python-prometheus-client)
+       ("python-attrs" ,python-attrs)
+       ("python-netaddr" ,python-netaddr)
+       ("python-jinja2" ,python-jinja2)
+       ("python-bleach" ,python-bleach)
+       ("python-typing-extensions" ,python-typing-extensions)
+       ;; conditional requirements (synapse/python_dependencies.py)
+       ("python-matrix-synapse-ldap3" ,python-matrix-synapse-ldap3)
+       ("python-psycopg2" ,python-psycopg2)
+       ("python-jinja2" ,python-jinja2)
+       ;; TODO txacme, eliot, pysaml2
+       ("python-lxml" ,python-lxml)
+       ;; TODO sentry-sdk, jaeger-client, opentracing
+       ("python-pyjwt" ,python-pyjwt)))
+    (native-inputs
+     `(("python-mock" ,python-mock)
+       ("python-parameterized" ,python-parameterized)))
+    (home-page "https://github.com/matrix-org/synapse")
+    (synopsis "Matrix reference homeserver")
+    (description "Synapse is a reference \"homeserver\" implementation of
+Matrix from the core development team at matrix.org, written in
+Python/Twisted.  It is intended to showcase the concept of Matrix and let
+folks see the spec in the context of a codebase and let you run your own
+homeserver and generally help bootstrap the ecosystem.")
+    (license license:asl2.0)))
-- 
2.25.1