mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-03-26 19:54:31 +00:00
Compare commits
No commits in common. "f58f1b058338fafa52e164e97b62cf622aef00e4" and "f8fb2556c305745172e70fe120c2d3f94b0680f0" have entirely different histories.
f58f1b0583
...
f8fb2556c3
@ -1,47 +0,0 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2026 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal packages guile-xyz)
|
||||
;; Utilities
|
||||
#:use-module (guix gexp)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (rosenthal utils packages)
|
||||
;; Guix origin methods
|
||||
#:use-module (guix git-download)
|
||||
;; Guix build systems
|
||||
#:use-module (guix build-system guile)
|
||||
;; Guix packages
|
||||
#:use-module (gnu packages guile)
|
||||
#:use-module (gnu packages guile-xyz))
|
||||
|
||||
(define-public guile-toml
|
||||
(let ((commit "ecb24deb407ef76ef7cf7e9f0115060c98366a6b")
|
||||
(revision "0"))
|
||||
(package
|
||||
(name "guile-toml")
|
||||
(version (git-version "0.0.0" revision commit))
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/hylophile/guile-toml")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"1iqxivxcb0dcjbd5ba3c0g3mj71b32qjxfdmljyv9r297yykfd02"))
|
||||
(patches
|
||||
(rosenthal-patches "guile-toml-support-boolean.patch"))))
|
||||
(build-system guile-build-system)
|
||||
(arguments
|
||||
(list #:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'avoid-test-installation
|
||||
(lambda _
|
||||
(delete-file-recursively "test"))))))
|
||||
(native-inputs (list guile-3.0))
|
||||
(propagated-inputs (list guile-json-4))
|
||||
(home-page "https://github.com/hylophile/guile-toml")
|
||||
(synopsis "TOML module for GNU Guile")
|
||||
(description "")
|
||||
(license license:gpl3+))))
|
||||
@ -1,37 +0,0 @@
|
||||
From 2f7e3c6f46233f9c9159fac61ca4121fe342107f Mon Sep 17 00:00:00 2001
|
||||
From: Hilton Chain <hako@ultrarare.space>
|
||||
Date: Thu, 26 Feb 2026 09:57:51 +0800
|
||||
Subject: [PATCH] builder: Support boolean value.
|
||||
|
||||
* toml/builder.scm (toml-build-boolean): New procedure.
|
||||
(toml-build-value): Use it.
|
||||
---
|
||||
toml/builder.scm | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/toml/builder.scm b/toml/builder.scm
|
||||
index f6bdcea..3531c6f 100644
|
||||
--- a/toml/builder.scm
|
||||
+++ b/toml/builder.scm
|
||||
@@ -74,6 +74,9 @@
|
||||
(else (string c))))
|
||||
(string->list s))))
|
||||
|
||||
+(define (toml-build-boolean b port)
|
||||
+ (put-string port (if b "true" "false")))
|
||||
+
|
||||
(define (toml-build-string s port)
|
||||
(define quote-type (if (or
|
||||
(string-contains s "\\")
|
||||
@@ -198,7 +201,7 @@
|
||||
(scm port #:key (newline? #t) (inline? #f))
|
||||
(cond
|
||||
;; ((eq? scm null) (toml-build-null port))
|
||||
- ;; ((boolean? scm) (toml-build-boolean scm port))
|
||||
+ ((boolean? scm) (toml-build-boolean scm port))
|
||||
;; ((symbol? scm) (toml-build-string (symbol->string scm) port))
|
||||
|
||||
;; TODO float (nan, inf)
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@ -185,7 +185,7 @@ reload its configuration file."))
|
||||
(string "/var/lib/conduit")
|
||||
"")
|
||||
(config
|
||||
gexp
|
||||
file-like
|
||||
"")
|
||||
;; Account
|
||||
(group-id
|
||||
@ -235,7 +235,6 @@ reload its configuration file."))
|
||||
(define conduit-shepherd
|
||||
(match-record-lambda <conduit-configuration>
|
||||
(conduit config auto-start? shepherd-provision shepherd-requirement)
|
||||
(let ((config-file (toml-file "conduit.toml" config)))
|
||||
(list (shepherd-service
|
||||
(provision shepherd-provision)
|
||||
(requirement `(networking user-processes ,@shepherd-requirement))
|
||||
@ -246,10 +245,10 @@ reload its configuration file."))
|
||||
#:group "conduit"
|
||||
#:log-file "/var/log/conduit.log"
|
||||
#:environment-variables
|
||||
(list (string-append "CONDUIT_CONFIG=" #$config-file))))
|
||||
(list (string-append "CONDUIT_CONFIG=" #$config))))
|
||||
(stop #~(make-kill-destructor))
|
||||
(actions
|
||||
(list (shepherd-configuration-action config-file))))))))
|
||||
(list (shepherd-configuration-action config)))))))
|
||||
|
||||
(define conduit-service-type
|
||||
(service-type
|
||||
@ -385,7 +384,7 @@ reload its configuration file."))
|
||||
(file-like iocaine)
|
||||
"")
|
||||
(config
|
||||
gexp
|
||||
file-object
|
||||
"")
|
||||
(log-file
|
||||
(string "/var/log/iocaine.log")
|
||||
@ -426,7 +425,7 @@ reload its configuration file."))
|
||||
(define iocaine-etc
|
||||
(match-record-lambda <iocaine-configuration>
|
||||
(config)
|
||||
`(("iocaine/iocaine.toml" ,(toml-file "iocaine.toml" config)))))
|
||||
`(("iocaine/iocaine.toml" ,config))))
|
||||
|
||||
(define iocaine-shepherd-service
|
||||
(match-record-lambda <iocaine-configuration>
|
||||
@ -744,8 +743,8 @@ test its configuration file."))
|
||||
(auto-start?
|
||||
(boolean #t)
|
||||
"")
|
||||
(config
|
||||
(gexp #~'())
|
||||
(extra-config
|
||||
(string "")
|
||||
"")
|
||||
(no-serialization))
|
||||
|
||||
@ -766,13 +765,14 @@ test its configuration file."))
|
||||
|
||||
(define navidrome-shepherd-service
|
||||
(match-record-lambda <navidrome-configuration>
|
||||
(navidrome ffmpeg auto-start? config)
|
||||
(navidrome ffmpeg auto-start? extra-config)
|
||||
(let ((config-file
|
||||
(toml-file "navidrome.toml"
|
||||
#~`(("DataFolder" . "/var/lib/navidrome")
|
||||
("CacheFolder" . "/var/lib/navidrome/cache")
|
||||
("EnableInsightsCollector" . #f)
|
||||
,@#$config))))
|
||||
(mixed-text-file
|
||||
"navidrome.toml"
|
||||
"DataFolder = '/var/lib/navidrome'\n"
|
||||
"CacheFolder = '/var/lib/navidrome/cache'\n"
|
||||
"EnableInsightsCollector = false\n"
|
||||
extra-config)))
|
||||
(list (shepherd-service
|
||||
(documentation "Run Navidrome.")
|
||||
(provision '(navidrome))
|
||||
|
||||
@ -9,14 +9,12 @@
|
||||
;; 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:
|
||||
@ -82,19 +80,6 @@ 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user