services: miniflux: Rename config to options.

* rosenthal/services/child-error.scm (miniflux-configuration)[miniflux]:
Switch to a package.
[config]: Rename to ...
[optinos]: ...this.
(miniflux-shepherd-service): Switch to MATCH-RECORD.
Construct single option with FORMAT.
pull/1/head
Hilton Chain 1 year ago
parent 5b132c8844
commit 7171134718
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292
  1. 32
      rosenthal/services/child-error.scm

@ -1,4 +1,4 @@
;; SPDX-FileCopyrightText: 2022 Hilton Chain <hako@ultrarare.space> ;; SPDX-FileCopyrightText: 2022, 2023 Hilton Chain <hako@ultrarare.space>
;; ;;
;; SPDX-License-Identifier: GPL-3.0-or-later ;; SPDX-License-Identifier: GPL-3.0-or-later
@ -10,6 +10,7 @@
#:use-module (gnu home services) #:use-module (gnu home services)
#:use-module (gnu home services shepherd) #:use-module (gnu home services shepherd)
#:use-module (gnu packages admin) #:use-module (gnu packages admin)
#:use-module (gnu packages web)
#:use-module (gnu services) #:use-module (gnu services)
#:use-module (gnu services configuration) #:use-module (gnu services configuration)
#:use-module (gnu services databases) #:use-module (gnu services databases)
@ -193,14 +194,14 @@ headers. This can expose sensitive information in your logs.")
(define-configuration/no-serialization miniflux-configuration (define-configuration/no-serialization miniflux-configuration
(miniflux (miniflux
(string "/bin/miniflux") (package miniflux)
"The miniflux executable.") "The miniflux package.")
(log-file (log-file
(string "/var/log/miniflux.log") (string "/var/log/miniflux.log")
"Where the logs go.") "Where the logs go.")
(config (options
(alist '()) (alist '())
"Association list of miniflux configurations.")) "Association list of miniflux configuration options."))
(define %miniflux-accounts (define %miniflux-accounts
(list (user-account (list (user-account
@ -215,16 +216,16 @@ headers. This can expose sensitive information in your logs.")
(name "miniflux") (name "miniflux")
(create-database? #t)))) (create-database? #t))))
(define miniflux-shepherd-service (define (miniflux-shepherd-service config)
(match-lambda (match-record config <miniflux-configuration>
(($ <miniflux-configuration> miniflux log-file config) (miniflux log-file options)
(let ((config-file (let ((config-file (mixed-text-file
(mixed-text-file
"miniflux.conf" "miniflux.conf"
(apply string-append (apply string-append
(map (lambda (alist) (map (lambda (option)
(string-append (car alist) "=" (cdr alist) "\n")) (format #f "~a=~a~%"
config))))) (car option) (cdr option)))
options)))))
(list (shepherd-service (list (shepherd-service
(documentation "Run miniflux.") (documentation "Run miniflux.")
(provision '(miniflux)) (provision '(miniflux))
@ -234,7 +235,7 @@ headers. This can expose sensitive information in your logs.")
#:user "miniflux" #:user "miniflux"
#:group "nogroup" #:group "nogroup"
#:log-file #$log-file)) #:log-file #$log-file))
(stop #~(make-kill-destructor)))))))) (stop #~(make-kill-destructor)))))))
(define miniflux-service-type (define miniflux-service-type
(service-type (service-type
@ -247,8 +248,7 @@ headers. This can expose sensitive information in your logs.")
(service-extension shepherd-root-service-type (service-extension shepherd-root-service-type
miniflux-shepherd-service))) miniflux-shepherd-service)))
(default-value (miniflux-configuration)) (default-value (miniflux-configuration))
(description (description "Run Miniflux, a minimalist and opinionated feed reader.")))
"Run Miniflux, a minimalist and opinionated feed reader.")))
;; ;;

Loading…
Cancel
Save