Rosenthal/rosenthal/services/mail.scm
Hilton Chain 3384f38b2b
services: Adapt to log rotation change.
* rosenthal/services/child-error.scm (clash-log-rotations)
(cloudflare-tunnel-log-rotations): Delete procedure.
(clash-service-type,cloudflare-tunnel-service-type)[extensions]: Extend
log-rotation-service-type.
* rosenthal/services/mail.scm (docker-mailserver-log-rotations): Delete
procedure.
(docker-mailserver-service-type)[extensions]: Extend
log-rotation-service-type.
* rosenthal/services/networking.scm (iwd-log-rotations)
(tailscale-log-rotations): Delete procedures.
(iwd-service-type,tailscale-service-type)[extensions]: Extend
log-rotation-service-type.
* rosenthal/services/web.scm (jellyfin-log-rotations,misskey-log-rotations)
(vaultwarden-log-rotations): Delete procedures.
(jellyfin-service-type,misskey-service-type,vaultwarden-service-type)[extensions]:
Extend log-rotation-service-type.
2025-01-17 13:58:24 +08:00

69 lines
2.5 KiB
Scheme

;; SPDX-FileCopyrightText: 2024 Hilton Chain <hako@ultrarare.space>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
(define-module (rosenthal services mail)
#:use-module (srfi srfi-26)
#:use-module (guix records)
#:use-module (gnu services)
#:use-module (gnu services admin)
#:use-module (gnu services configuration)
#:use-module (gnu services docker)
#:export (docker-mailserver-configuration
docker-mailserver-service-type))
;;;
;;; Docker Mailserver
;;; https://docker-mailserver.github.io/docker-mailserver/latest/
;;;
(define-configuration docker-mailserver-configuration
(data-directory
(string "/var/lib/docker-mailserver")
"Directory to store Docker Mailserver data.")
(log-file
(string "/var/log/docker-mailserver.log")
"Path to log file.")
(shepherd-requirement
(list-of-symbols '())
"List of Shepherd service dependencies.")
(options
(alist '())
"Alist of Docker Mailserver configuration. See also
@url{https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/}.")
(extra-arguments
(list '())
"List of extra Docker arguments.")
(no-serialization))
(define docker-mailserver-oci-containers
(match-record-lambda <docker-mailserver-configuration>
(data-directory log-file shepherd-requirement options extra-arguments)
(let ((docker-mailserver-path
(cut string-append data-directory <>)))
(list (oci-container-configuration
(environment options)
(image "ghcr.io/docker-mailserver/docker-mailserver:latest")
(provision "docker-mailserver")
(requirement shepherd-requirement)
(log-file log-file)
(network "host")
(volumes
`((,(docker-mailserver-path "/data") . "/var/mail")
(,(docker-mailserver-path "/state") . "/var/mail-state")
(,(docker-mailserver-path "/logs") . "/var/log/mail")
(,(docker-mailserver-path "/config") . "/tmp/docker-mailserver")
("/etc/localtime" . "/etc/localtime:ro")))
(extra-arguments extra-arguments))))))
(define docker-mailserver-service-type
(service-type
(name 'docker-mailserver)
(extensions
(list (service-extension oci-container-service-type
docker-mailserver-oci-containers)
(service-extension log-rotation-service-type
(compose list docker-mailserver-configuration-log-file))))
(default-value (docker-mailserver-configuration))
(description "Run Docker Mailserver.")))