Compare commits

..

9 Commits

Author SHA1 Message Date
Hilton Chain
0d15cfdb28
services: Add heisenbridge-service-type.
* modules/rosenthal/services/messaging.scm (<heisenbridge-configuration>): New
data type.
(heisenbridge-service-type): New variable.
2025-11-03 20:04:53 +08:00
Hilton Chain
312452d1dd
rosenthal: Add heisenbridge.
* modules/rosenthal/packages/messaging.scm (heisenbridge): New variable.
2025-11-03 20:04:50 +08:00
Hilton Chain
90a4db4e4f
rosenthal: Add python-irc.
* modules/rosenthal/packages/python-xyz.scm (python-irc): New variable.
2025-11-03 20:03:21 +08:00
Hilton Chain
3d1539423b
rosenthal: Add python-jaraco-stream.
* modules/rosenthal/packages/python-xyz.scm (python-jaraco-stream): New
variable.
2025-11-03 20:03:19 +08:00
Hilton Chain
69c7d35eb5
rosenthal: Add python-jaraco-logging.
* modules/rosenthal/packages/python-xyz.scm (python-jaraco-logging): New
variable.
2025-11-03 20:03:10 +08:00
Hilton Chain
92ffe18fd6
rosenthal: Add python-coherent-licensed.
* modules/rosenthal/packages/python-xyz.scm (python-coherent-licensed): New
variable.
2025-11-03 19:51:28 +08:00
Hilton Chain
a0f7d82605
rosenthal: mautrix-telegram: Fix path.
* modules/rosenthal/packages/messaging.scm (mautrix-telegram) [#:phases]
<install-extras>: Fix path.
[inputs]: Add ffmpeg, lottie-converter, python.
2025-11-03 19:42:52 +08:00
Hilton Chain
423b906417
rosenthal: Add lottie-converter.
* modules/rosenthal/packages/animation.scm (lottie-converter): New variable.
2025-11-03 19:42:48 +08:00
Hilton Chain
56ed0382d7
services: Add mautrix-telegram-service-type.
* modules/rosenthal/services/messaging.scm (<mautrix-telegram-configuration>):
New data type.
* modules/rosenthal/services/messaging.scm (mautrix-telegram-service-type):
New variable.
2025-11-03 19:38:17 +08:00
4 changed files with 358 additions and 3 deletions

View File

@ -0,0 +1,49 @@
;;; SPDX-FileCopyrightText: 2025 Hilton Chain <hako@ultrarare.space>
;;;
;;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal packages animation)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages animation)
#:use-module (gnu packages compression)
#:use-module (gnu packages image)
#:use-module (guix build-system cmake)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (guix utils))
(define-public lottie-converter
(let ((commit "3ad34af7bbcf9197fda782a5832b18b72a3bb939")
(revision "0"))
(package
(name "lottie-converter")
(version (git-version "0.2" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/sot-tech/LottieConverter")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"12py6y05cv38cri0q813m7nsaizhqjnqnq0jp6bfviam5cq240p8"))))
(build-system cmake-build-system)
(arguments
(list #:configure-flags
#~(list "-DSYSTEM_PNG=1"
"-DSYSTEM_RL=1"
"-DSYSTEM_GL=1")
#:phases
#~(modify-phases %standard-phases
(replace 'install
(lambda _
(let ((bindir (in-vicinity #$output "bin")))
(install-file "lottieconverter" bindir)))))))
(inputs (list giflib libpng rlottie zlib))
(synopsis "Lottie animation converter")
(description "This package provides a simple lottie animation converter.
Animations can be converted to PNG (with transparency) or GIF.")
(home-page "https://github.com/sot-tech/LottieConverter")
(license license:bsd-3))))

View File

@ -7,19 +7,55 @@
#:use-module (gnu packages crypto) #:use-module (gnu packages crypto)
#:use-module (gnu packages databases) #:use-module (gnu packages databases)
#:use-module (gnu packages monitoring) #:use-module (gnu packages monitoring)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build) #:use-module (gnu packages python-build)
#:use-module (gnu packages python-compression) #:use-module (gnu packages python-compression)
#:use-module (gnu packages python-crypto) #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-web) #:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz) #:use-module (gnu packages python-xyz)
#:use-module (gnu packages serialization) #:use-module (gnu packages serialization)
#:use-module (gnu packages video)
#:use-module (guix build-system pyproject) #:use-module (guix build-system pyproject)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (rosenthal packages animation)
#:use-module (rosenthal packages python-xyz)) #:use-module (rosenthal packages python-xyz))
(define-public heisenbridge
(package
(name "heisenbridge")
(version "1.15.4")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/hifi/heisenbridge")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1viv18bkj0lccr00218xp818i923h1ax7c50kl0yn834axdz6y4l"))))
(build-system pyproject-build-system)
(arguments (list #:tests? #f)) ;TODO
(native-inputs
(list python-setuptools))
(propagated-inputs
(list python-aiohttp
python-irc
python-mautrix
python-ruamel.yaml
python-socks))
(synopsis "Bouncer-style Matrix IRC bridge")
(description
"Heisenbridge brings IRC to Matrix by creating an environment where every
user connects to each network individually like they would with a traditional
IRC bouncer. Simplicity is achieved by exposing IRC in the most straightforward
way as possible where it makes sense so it feels familiar for long time IRC
users.")
(home-page "https://github.com/hifi/heisenbridge")
(license license:expat)))
(define-public mautrix-telegram (define-public mautrix-telegram
(package (package
(name "mautrix-telegram") (name "mautrix-telegram")
@ -39,7 +75,7 @@
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'install 'install-extras (add-after 'install 'install-extras
(lambda _ (lambda* (#:key inputs #:allow-other-keys)
(let* ((bindir (in-vicinity #$output "bin")) (let* ((bindir (in-vicinity #$output "bin"))
(etcdir (in-vicinity #$output "etc/mautrix-telegram")) (etcdir (in-vicinity #$output "etc/mautrix-telegram"))
(bin (in-vicinity bindir "mautrix-telegram")) (bin (in-vicinity bindir "mautrix-telegram"))
@ -51,8 +87,13 @@
(lambda (port) (lambda (port)
(format port "~ (format port "~
#!/bin/sh #!/bin/sh
python3 -m mautrix_telegram \"$@\"~%"))) PATH=~a:~a:$PATH
~a -m mautrix_telegram \"$@\"~%"
(dirname (dirname (search-input-file inputs "bin/ffmpeg")))
(dirname (dirname (search-input-file inputs "bin/lottieconverter")))
(search-input-file inputs "bin/python3"))))
(chmod bin #o555))))))) (chmod bin #o555)))))))
(native-inputs (native-inputs
(list python-setuptools)) (list python-setuptools))
(propagated-inputs (propagated-inputs
@ -65,7 +106,10 @@ python3 -m mautrix_telegram \"$@\"~%")))
python-ruamel.yaml python-ruamel.yaml
python-tulir-telethon)) python-tulir-telethon))
(inputs (inputs
(list python-aiodns (list ffmpeg
lottie-converter
python
python-aiodns
python-aiosqlite python-aiosqlite
python-brotli python-brotli
python-olm python-olm

View File

@ -14,6 +14,7 @@
#:use-module (gnu packages python-xyz) #:use-module (gnu packages python-xyz)
#:use-module (gnu packages rust) #:use-module (gnu packages rust)
#:use-module (gnu packages serialization) #:use-module (gnu packages serialization)
#:use-module (gnu packages time)
#:use-module (guix build-system cargo) #:use-module (guix build-system cargo)
#:use-module (guix build-system pyproject) #:use-module (guix build-system pyproject)
#:use-module (guix build-system python) #:use-module (guix build-system python)
@ -24,6 +25,27 @@
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (rosenthal utils cargo)) #:use-module (rosenthal utils cargo))
(define-public python-coherent-licensed
(package
(name "python-coherent-licensed")
(version "0.5.2")
(source
(origin
(method url-fetch)
(uri (pypi-uri "coherent_licensed" version))
(sha256
(base32 "0va113rfa0i8sns2if8mnkzwliks0nvlzp1db71klbblrq1i81yq"))))
(build-system pyproject-build-system)
(native-inputs (list python-flit-core))
(home-page "https://pypi.org/project/coherent.licensed/")
(synopsis "License management tooling")
(description
"This library was built for
@url{https://github.com/coherent-oss/coherent.build, coherent.build} and
@url{https://blog.jaraco.com/skeleton, skeleton} projects to inject a license
file at build time to reflect the license declared in the license expression.")
(license license:expat)))
(define-public python-cryptg (define-public python-cryptg
(package (package
(name "python-cryptg") (name "python-cryptg")
@ -79,6 +101,91 @@
to work with the Telegram API, which uses the uncommon AES-IGE mode for it.") to work with the Telegram API, which uses the uncommon AES-IGE mode for it.")
(license license:cc0))) (license license:cc0)))
(define-public python-irc
(package
(name "python-irc")
(version "20.3.1")
(source
(origin
(method url-fetch)
(uri (pypi-uri "irc" version))
(sha256
(base32 "02r8fb15wb6b9rf4kh3cvs48a4j00slncj71s4g152sdi6pq6sw0"))))
(build-system pyproject-build-system)
(native-inputs
(list python-setuptools
python-setuptools-scm
python-pytest))
(propagated-inputs
(list python-jaraco-collections
python-jaraco-functools
python-jaraco-logging
python-jaraco-stream
python-jaraco-text
python-more-itertools
python-pytz
python-tempora))
(home-page "https://github.com/jaraco/irc")
(synopsis "Python Internet Relay Chat protocol library")
(description
"This library provides a low-level implementation of the @acronym{IRC,
Internet Relay Chat} protocol for Python. It provides an event-driven IRC
client framework. It has a fairly thorough support for the basic IRC protocol,
@acronym{CTCP, Client-to-Client Protocol}, and @acronym{DCC, Direct
Client-to-Client} connections.")
(license license:expat)))
(define-public python-jaraco-logging
(package
(name "python-jaraco-logging")
(version "3.4.0")
(source
(origin
(method url-fetch)
(uri (pypi-uri "jaraco_logging" version))
(sha256
(base32 "1yvmnyq120sqfcbzvqrcjk5a35jqh0fqbvfnn6gfcz27d21xrmp7"))))
(build-system pyproject-build-system)
(native-inputs
(list python-coherent-licensed
python-pytest
python-setuptools
python-setuptools-scm
python-wheel))
(propagated-inputs
(list python-tempora))
(home-page "https://github.com/jaraco/jaraco.logging")
(synopsis "Python logging facility")
(description
"This package provides additional facilities to supplement Python's
standard logging module.")
(license license:expat)))
(define-public python-jaraco-stream
(package
(name "python-jaraco-stream")
(version "3.0.4")
(source
(origin
(method url-fetch)
(uri (pypi-uri "jaraco_stream" version))
(sha256
(base32 "0jwk85k14zb1pvppxy6vnbln8xib7yiwjvmrab42rv91wwl51g72"))))
(build-system pyproject-build-system)
(native-inputs
(list python-pytest
python-setuptools
python-setuptools-scm
python-wheel))
(propagated-inputs
(list python-more-itertools))
(home-page "https://github.com/jaraco/jaraco.stream")
(synopsis "Routines for dealing with data streams")
(description
"This package provides routines for handling streaming data, including a
set of generators for loading gzip data on the fly.")
(license license:expat)))
(define-public python-mautrix (define-public python-mautrix
(package (package
(name "python-mautrix") (name "python-mautrix")

View File

@ -0,0 +1,155 @@
;;; SPDX-FileCopyrightText: 2025 Hilton Chain <hako@ultrarare.space>
;;;
;;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services messaging)
#:use-module (gnu services configuration)
#:use-module (gnu services databases)
#:use-module (gnu services shepherd)
#:use-module (gnu services)
#:use-module (gnu system shadow)
#:use-module (guix gexp)
#:use-module (guix modules)
#:use-module (guix records)
#:use-module (rosenthal packages messaging)
#:export (heisenbridge-service-type
heisenbridge-configuration
mautrix-telegram-service-type
mautrix-telegram-configuration))
;;;
;;; Heisenbridge
;;;
(define-configuration/no-serialization heisenbridge-configuration
(heisenbridge
(file-like heisenbridge)
"")
(homeserver
(string "http://localhost:8008")
"")
(config
file-like
"")
(shepherd-provision
(list-of-symbols '(heisenbridge))
"")
(shepherd-requirement
(list-of-symbols '())
"")
(auto-start?
(boolean #t)
""))
(define heisenbridge-account
(list (user-group (name "heisenbridge") (system? #t))
(user-account
(name "heisenbridge")
(group "heisenbridge")
(system? #t)
(home-directory "/var/empty"))))
(define heisenbridge-shepherd
(match-record-lambda <heisenbridge-configuration>
(heisenbridge config homeserver shepherd-provision shepherd-requirement auto-start?)
(list (shepherd-service
(provision shepherd-provision)
(requirement `(user-processes networking ,@shepherd-requirement))
(start
#~(make-forkexec-constructor
(list #$(file-append heisenbridge "/bin/heisenbridge")
"--config" #$config #$homeserver)
#:user "heisenbridge"
#:group "heisenbridge"
#:environment-variables
'("PATH=/run/current-system/profile/bin"
"SSL_CERT_DIR=/run/current-system/profile/etc/ssl/certs"
"SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt")))
(stop #~(make-kill-destructor))
(auto-start? auto-start?)
(actions (list (shepherd-configuration-action config)))))))
(define heisenbridge-service-type
(service-type
(name 'heisenbridge)
(extensions
(list (service-extension account-service-type
(const heisenbridge-account))
(service-extension shepherd-root-service-type
heisenbridge-shepherd)))
(description "")))
;;;
;;; Mautrix Telegram
;;;
(define-configuration/no-serialization mautrix-telegram-configuration
(mautrix-telegram
(file-like mautrix-telegram)
"")
(config
file-like
"")
(shepherd-provision
(list-of-symbols '(mautrix-telegram))
"")
(shepherd-requirement
(list-of-symbols '())
"")
(auto-start?
(boolean #t)
""))
(define mautrix-telegram-account
(list (user-group (name "mautrix") (system? #t))
(user-account
(name "mautrix-telegram")
(group "mautrix")
(system? #t)
(home-directory "/var/lib/mautrix-telegram"))))
(define mautrix-telegram-activation
(with-imported-modules (source-module-closure '((gnu build activation)))
#~(begin
(use-modules (gnu build activation))
(let ((user (getpwnam "mautrix-telegram")))
(mkdir-p/perms "/var/lib/mautrix-telegram" user #o700)))))
(define mautrix-telegram-postgresql-role
(list (postgresql-role
(name "mautrix-telegram")
(create-database? #t))))
(define mautrix-telegram-shepherd
(match-record-lambda <mautrix-telegram-configuration>
(mautrix-telegram config shepherd-provision shepherd-requirement auto-start?)
(list (shepherd-service
(provision shepherd-provision)
(requirement
`(user-processes networking postgresql ,@shepherd-requirement))
(start
#~(make-forkexec-constructor
(list #$(file-append mautrix-telegram "/bin/mautrix-telegram")
"--no-update" "--config" #$config)
#:user "mautrix-telegram"
#:group "mautrix"
#:directory "/var/lib/mautrix-telegram"))
(stop #~(make-kill-destructor))
(auto-start? auto-start?)
(actions (list (shepherd-configuration-action config)))))))
(define mautrix-telegram-service-type
(service-type
(name 'mautrix-telegram)
(extensions
(list (service-extension account-service-type
(const mautrix-telegram-account))
(service-extension activation-service-type
(const mautrix-telegram-activation))
(service-extension postgresql-role-service-type
(const mautrix-telegram-postgresql-role))
(service-extension shepherd-root-service-type
mautrix-telegram-shepherd)))
(description "")))