matrix.scm 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2020 Alex ter Weele <alex.ter.weele@gmail.com>
  3. ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  4. ;;; Copyright © 2020, 2021 Michael Rohleder <mike@rohleder.de>
  5. ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages matrix)
  22. #:use-module ((guix licenses) #:prefix license:)
  23. #:use-module (gnu packages check)
  24. #:use-module (gnu packages crypto)
  25. #:use-module (gnu packages databases)
  26. #:use-module (gnu packages monitoring)
  27. #:use-module (gnu packages python-build)
  28. #:use-module (gnu packages python-check)
  29. #:use-module (gnu packages python-crypto)
  30. #:use-module (gnu packages python-web)
  31. #:use-module (gnu packages python-xyz)
  32. #:use-module (gnu packages xml)
  33. #:use-module (guix build-system python)
  34. #:use-module (guix download)
  35. #:use-module (guix git-download)
  36. #:use-module (guix packages))
  37. (define-public python-matrix-client
  38. (package
  39. (name "python-matrix-client")
  40. (version "0.3.2")
  41. (source
  42. (origin
  43. (method url-fetch)
  44. (uri (pypi-uri "matrix-client" version))
  45. (sha256
  46. (base32
  47. "1mgjd0ymf9mvqjkvgx3xjhxap7rzdmpa21wfy0cxbw2xcswcrqyw"))))
  48. (build-system python-build-system)
  49. (propagated-inputs
  50. `(("python-requests" ,python-requests)))
  51. (native-inputs
  52. `(("python-pytest" ,python-pytest)
  53. ("python-pytest-runner" ,python-pytest-runner)
  54. ("python-responses" ,python-responses)))
  55. (home-page
  56. "https://github.com/matrix-org/matrix-python-sdk")
  57. (synopsis "Client-Server SDK for Matrix")
  58. (description "This package provides client-server SDK for Matrix.")
  59. (license license:asl2.0)))
  60. (define-public python-matrix-synapse-ldap3
  61. (package
  62. (name "python-matrix-synapse-ldap3")
  63. (version "0.1.4")
  64. (source
  65. (origin
  66. (method url-fetch)
  67. (uri (pypi-uri "matrix-synapse-ldap3" version))
  68. (sha256
  69. (base32
  70. "01bms89sl16nyh9f141idsz4mnhxvjrc3gj721wxh1fhikps0djx"))))
  71. (build-system python-build-system)
  72. (arguments
  73. ;; tests require synapse, creating a circular dependency.
  74. '(#:tests? #f))
  75. (propagated-inputs
  76. `(("python-twisted" ,python-twisted)
  77. ("python-ldap3" ,python-ldap3)
  78. ("python-service-identity" ,python-service-identity)))
  79. (home-page "https://github.com/matrix-org/matrix-synapse-ldap3")
  80. (synopsis "LDAP3 auth provider for Synapse")
  81. (description
  82. "This package allows Synapse to use LDAP as a password provider.
  83. This lets users log in to Synapse with their username and password from
  84. an LDAP server.")
  85. (license license:asl2.0)))
  86. (define-public synapse
  87. (package
  88. (name "synapse")
  89. (version "1.29.0")
  90. (source (origin
  91. (method url-fetch)
  92. (uri (pypi-uri "matrix-synapse" version))
  93. (sha256
  94. (base32
  95. "0if2yhpz8psg0661401mvxznldbfhk2j9rhbs25jdaqm9jsv6907"))))
  96. (build-system python-build-system)
  97. ;; TODO Run tests with ‘PYTHONPATH=. trial3 tests’.
  98. (propagated-inputs
  99. `(("python-simplejson" ,python-simplejson) ; not attested but required
  100. ;; requirements (synapse/python_dependencies.py)
  101. ("python-jsonschema" ,python-jsonschema)
  102. ("python-frozendict" ,python-frozendict)
  103. ("python-unpaddedbase64" ,python-unpaddedbase64)
  104. ("python-canonicaljson" ,python-canonicaljson)
  105. ("python-signedjson" ,python-signedjson)
  106. ("python-pynacl" ,python-pynacl)
  107. ("python-idna" ,python-idna)
  108. ("python-service-identity" ,python-service-identity)
  109. ("python-twisted" ,python-twisted)
  110. ("python-treq" ,python-treq)
  111. ("python-pyopenssl" ,python-pyopenssl)
  112. ("python-pyyaml" ,python-pyyaml)
  113. ("python-pyasn1" ,python-pyasn1)
  114. ("python-pyasn1-modules" ,python-pyasn1-modules)
  115. ("python-daemonize" ,python-daemonize)
  116. ("python-bcrypt" ,python-bcrypt)
  117. ("python-pillow" ,python-pillow)
  118. ("python-sortedcontainers" ,python-sortedcontainers)
  119. ("python-pymacaroons" ,python-pymacaroons)
  120. ("python-msgpack" ,python-msgpack)
  121. ("python-phonenumbers" ,python-phonenumbers)
  122. ("python-six" ,python-six)
  123. ("python-prometheus-client" ,python-prometheus-client)
  124. ("python-attrs" ,python-attrs)
  125. ("python-netaddr" ,python-netaddr)
  126. ("python-jinja2" ,python-jinja2)
  127. ("python-bleach" ,python-bleach)
  128. ("python-typing-extensions" ,python-typing-extensions)
  129. ;; conditional requirements (synapse/python_dependencies.py)
  130. ;;("python-hiredis" ,python-hiredis)
  131. ("python-matrix-synapse-ldap3" ,python-matrix-synapse-ldap3)
  132. ("python-psycopg2" ,python-psycopg2)
  133. ("python-jinja2" ,python-jinja2)
  134. ("python-txacme" ,python-txacme)
  135. ("python-pysaml2" ,python-pysaml2)
  136. ("python-lxml" ,python-lxml)
  137. ("python-packaging" ,python-packaging)
  138. ;; sentry-sdk, jaeger-client, and opentracing could be included, but
  139. ;; all are monitoring aids and not essential.
  140. ("python-pyjwt" ,python-pyjwt)))
  141. (native-inputs
  142. `(("python-mock" ,python-mock)
  143. ("python-parameterized" ,python-parameterized)))
  144. (home-page "https://github.com/matrix-org/synapse")
  145. (synopsis "Matrix reference homeserver")
  146. (description "Synapse is a reference \"homeserver\" implementation of
  147. Matrix from the core development team at matrix.org, written in
  148. Python/Twisted. It is intended to showcase the concept of Matrix and let
  149. folks see the spec in the context of a codebase and let you run your own
  150. homeserver and generally help bootstrap the ecosystem.")
  151. (license license:asl2.0)))
  152. (define-public python-matrix-nio
  153. (package
  154. (name "python-matrix-nio")
  155. (version "0.18.7")
  156. (source
  157. (origin
  158. (method url-fetch)
  159. (uri (pypi-uri "matrix-nio" version))
  160. (sha256
  161. (base32 "0cw4y6dx8n8hynxqlzzkj8p34nfbc2xryvmkr5yhmja31y4rks4k"))))
  162. (build-system python-build-system)
  163. (arguments
  164. `(#:phases
  165. (modify-phases %standard-phases
  166. (add-before 'check 'install-tests
  167. (lambda* (#:key inputs outputs #:allow-other-keys)
  168. (copy-recursively (string-append
  169. (assoc-ref inputs "tests") "/tests")
  170. "tests")
  171. #t))
  172. (replace 'check
  173. (lambda* (#:key tests? inputs outputs #:allow-other-keys)
  174. (when tests?
  175. (add-installed-pythonpath inputs outputs)
  176. ;; FIXME: two tests fail, for unknown reasons
  177. (invoke "python" "-m" "pytest" "-vv" "tests" "-k"
  178. (string-append
  179. "not test_upload_binary_file_object "
  180. "and not test_connect_wrapper"))))))))
  181. (native-inputs
  182. `(("python-pytest" ,python-pytest-6)
  183. ("python-hyperframe" ,python-hyperframe)
  184. ("python-hypothesis" ,python-hypothesis-6.23)
  185. ("python-hpack" ,python-hpack)
  186. ("python-faker" ,python-faker)
  187. ("python-pytest-aiohttp" ,python-pytest-aiohttp)
  188. ("python-aioresponses" ,python-aioresponses)
  189. ("python-pytest-benchmark" ,python-pytest-benchmark)
  190. ("python-toml" ,python-toml)
  191. ("tests"
  192. ;; The release on pypi comes without tests. We can't build from this
  193. ;; checkout, though, because installation requires an invocation of
  194. ;; poetry.
  195. ,(origin
  196. (method git-fetch)
  197. (uri (git-reference
  198. (url "https://github.com/poljar/matrix-nio.git")
  199. (commit version)))
  200. (file-name (git-file-name name version))
  201. (sha256
  202. (base32
  203. "152prkndk53pfxm4in4xak4hwzyaxlbp6wv2zbk2xpzgyy9bvn3s"))))))
  204. (propagated-inputs
  205. `(("python-aiofiles" ,python-aiofiles)
  206. ("python-aiohttp" ,python-aiohttp)
  207. ("python-aiohttp-socks" ,python-aiohttp-socks)
  208. ("python-atomicwrites" ,python-atomicwrites-1.4)
  209. ("python-cachetools" ,python-cachetools)
  210. ("python-future" ,python-future)
  211. ("python-h11" ,python-h11)
  212. ("python-h2" ,python-h2)
  213. ("python-jsonschema" ,python-jsonschema)
  214. ("python-logbook" ,python-logbook)
  215. ("python-olm" ,python-olm)
  216. ("python-peewee" ,python-peewee)
  217. ("python-pycryptodome" ,python-pycryptodome)
  218. ("python-unpaddedbase64" ,python-unpaddedbase64)))
  219. (home-page "https://github.com/poljar/matrix-nio")
  220. (synopsis
  221. "Python Matrix client library, designed according to sans I/O principles")
  222. (description
  223. "Matrix nio is a multilayered Matrix client library. The underlying base
  224. layer doesn't do any network IO on its own, but on top of that is a full
  225. fledged batteries-included asyncio layer using aiohttp.")
  226. (license license:isc)))
  227. (define-public pantalaimon
  228. (package
  229. (name "pantalaimon")
  230. (version "0.10.3")
  231. (source
  232. (origin
  233. (method git-fetch)
  234. (uri (git-reference
  235. (url "https://github.com/matrix-org/pantalaimon")
  236. (commit version)))
  237. (file-name (git-file-name name version))
  238. (sha256
  239. (base32
  240. "153d8083lj3qqirbv5q1d3igzd61a5kyzfk7xmv29sd3jbs8ysm9"))))
  241. (build-system python-build-system)
  242. (arguments
  243. `(#:phases
  244. (modify-phases %standard-phases
  245. (add-after 'unpack 'downgrade-appdirs-requirement
  246. (lambda _
  247. (substitute* "setup.py"
  248. ;; FIXME: Remove this once appdirs is updated.
  249. ;; Upgrading python-appdirs requires rebuilting 3000+ packages,
  250. ;; when 1.4.4 is a simple maintenance fix from 1.4.3.
  251. (("appdirs >= 1.4.4") "appdirs >= 1.4.3"))))
  252. (replace 'check
  253. (lambda* (#:key tests? inputs outputs #:allow-other-keys)
  254. (when tests?
  255. (add-installed-pythonpath inputs outputs)
  256. (invoke "pytest" "-vv" "tests")))))))
  257. (native-inputs
  258. `(("python-pytest" ,python-pytest)
  259. ("python-faker" ,python-faker)
  260. ("python-pytest-aiohttp" ,python-pytest-aiohttp)
  261. ("python-aioresponses" ,python-aioresponses)))
  262. (propagated-inputs
  263. `(("python-aiohttp" ,python-aiohttp)
  264. ("python-appdirs" ,python-appdirs)
  265. ("python-attrs" ,python-attrs)
  266. ("python-cachetools" ,python-cachetools)
  267. ("python-click" ,python-click)
  268. ("python-janus" ,python-janus)
  269. ("python-keyring" ,python-keyring)
  270. ("python-logbook" ,python-logbook)
  271. ("python-matrix-nio" ,python-matrix-nio)
  272. ("python-peewee" ,python-peewee)
  273. ("python-prompt-toolkit" ,python-prompt-toolkit)))
  274. (home-page "https://github.com/matrix-org/pantalaimon")
  275. (synopsis "Matrix proxy daemon that adds E2E encryption capabilities")
  276. (description
  277. "Pantalaimon is an end-to-end encryption aware Matrix reverse proxy
  278. daemon. Pantalaimon acts as a good man in the middle that handles the
  279. encryption for you. Messages are transparently encrypted and decrypted for
  280. clients inside of pantalaimon.")
  281. (license license:asl2.0)))