matrix.scm 11 KB

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