utils: Add toml-file.

* modules/rosenthal/utils/file.scm (toml-file): New procedure.
* modules/rosenthal/services/web.scm (conduit-shepherd, iocaine-etc)
(navidrome-shepherd-service): Use it.
This commit is contained in:
Hilton Chain committed 2026-02-26 10:26:42 +08:00
1 parent 19a9eaa029
commit f58f1b0583
2 files changed
+41 -26

No files matched your search

+15
View File
@@ -9,12 +9,14 @@
;; Guix packages
#:use-module (gnu packages guile)
#:use-module (gnu packages guile-xyz)
#:use-module (rosenthal packages guile-xyz)
#:export (computed-substitution-with-inputs
file-content
hidden-desktop-entry
ini-file
json-file
toml-file
yaml-file))
;; XXX: ‘substitute*’ doesn't fully support Unicode:
@@ -80,6 +82,19 @@ format."
(call-with-output-file #$output
(cut scm->json #$exp <> #:pretty #t))))))
;; https://github.com/hylophile/guile-toml
;; TODO: TOML writing support is incomplete.
;; See https://github.com/hylophile/guile-toml/blob/main/toml/builder.scm.
(define (toml-file name exp)
"Return file-like object NAME, serialized from G-expression EXP in TOML
format."
(computed-file name
(with-extensions (list guile-json-4 guile-toml)
#~(begin
(use-modules (srfi srfi-26) (toml))
(call-with-output-file #$output
(cut scm->toml #$exp <>))))))
;; https://gitlab.com/yorgath/guile-yamlpp
(define (yaml-file name exp)
"Return file-like object NAME, serialized from G-expression EXP in YAML