From ed43a49877a210cf9e3c290d03617b33ccaa0bf5 Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Sat, 25 Jul 2026 23:06:13 +0800 Subject: [PATCH] services: jellyfin: Use the contract system. --- modules/rosenthal/services/web.scm | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/rosenthal/services/web.scm b/modules/rosenthal/services/web.scm index b264645..12c79b2 100644 --- a/modules/rosenthal/services/web.scm +++ b/modules/rosenthal/services/web.scm @@ -7,8 +7,10 @@ #:use-module (guix modules) #:use-module (guix packages) #:use-module (guix records) + #:use-module (rosenthal utils contract combinators) #:use-module (rosenthal utils file) #:use-module (rosenthal utils predicates) + #:use-module (rosenthal utils records) ;; Guix origin methods #:use-module (guix download) ;; Guix System @@ -392,7 +394,7 @@ test its configuration file.")) ;;; Jellyfin media system (Native, currently written for the Nix package). ;;; -(define-record-type* +(define-record-type/dolly jellyfin-configuration make-jellyfin-configuration jellyfin-configuration? @@ -462,9 +464,9 @@ test its configuration file.")) (documentation "Extra command-line options."))) -(define (jellyfin-account-service config) - (match-record config - (data-directory user group) +(define jellyfin-account-service + (match-record-lambda/dolly + (data-directory user group) (list (user-group (name "jellyfin") (id group) @@ -478,9 +480,9 @@ test its configuration file.")) (shell (file-append shadow "/sbin/nologin")) (system? #t))))) -(define (jellyfin-activation-service config) - (match-record config - (data-directory config-directory cache-directory log-directory) +(define jellyfin-activation-service + (match-record-lambda/dolly + (data-directory config-directory cache-directory log-directory) #~(let ((owner (getpwnam "jellyfin"))) (for-each (lambda (dir) (mkdir-p/perms dir owner #o755)) @@ -489,11 +491,11 @@ test its configuration file.")) cache-directory log-directory))))) -(define (jellyfin-shepherd-service config) - (match-record config - (jellyfin - data-directory config-directory cache-directory log-directory - shepherd-requirement extra-options) +(define jellyfin-shepherd-service + (match-record-lambda/dolly + (jellyfin + data-directory config-directory cache-directory log-directory + shepherd-requirement extra-options) (list (shepherd-service (documentation "Run the Jellyfin media system.") (provision '(jellyfin))