mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-03-04 17:04:21 +00:00
utils: Add json-file.
* modules/rosenthal/utils/file.scm (json-file): New procedure. * modules/rosenthal/services/desktop.scm (%rosenthal-skeletons-installer) [.cache/noctalia/shell-state.json]: Use it.
This commit is contained in:
parent
c2630512c6
commit
f8fb2556c3
@ -597,20 +597,12 @@ gtk-key-theme-name = ~a~%"
|
|||||||
,(local-file "../examples/dot-config/wezterm/wezterm.lua"))
|
,(local-file "../examples/dot-config/wezterm/wezterm.lua"))
|
||||||
;; Prevent Noctalia shell initial screen.
|
;; Prevent Noctalia shell initial screen.
|
||||||
(".cache/noctalia/shell-state.json"
|
(".cache/noctalia/shell-state.json"
|
||||||
,(computed-file "noctalia-shell-state.json"
|
,(json-file "noctalia-shell-state.json"
|
||||||
(with-extensions (list guile-json-4)
|
#~'(("changelogState"
|
||||||
#~(begin
|
|
||||||
(use-modules (json))
|
|
||||||
(call-with-output-file #$output
|
|
||||||
(lambda (port)
|
|
||||||
(scm->json
|
|
||||||
`(("changelogState"
|
|
||||||
("lastSeenVersion"
|
("lastSeenVersion"
|
||||||
. ,(string-append "v" #$(package-version noctalia-shell))))
|
. #$(string-append "v" (package-version noctalia-shell))))
|
||||||
("telemetry"
|
("telemetry"
|
||||||
("instanceId" . "")))
|
("instanceId" . "")))))
|
||||||
port
|
|
||||||
#:pretty #t)))))))
|
|
||||||
,@%rosenthal-skeletons))
|
,@%rosenthal-skeletons))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,12 +7,14 @@
|
|||||||
;; Utilities
|
;; Utilities
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
;; Guix packages
|
;; Guix packages
|
||||||
|
#:use-module (gnu packages guile)
|
||||||
#:use-module (gnu packages guile-xyz)
|
#:use-module (gnu packages guile-xyz)
|
||||||
#:export (computed-substitution-with-inputs
|
#:export (computed-substitution-with-inputs
|
||||||
file-content
|
file-content
|
||||||
hidden-desktop-entry
|
hidden-desktop-entry
|
||||||
|
|
||||||
ini-file
|
ini-file
|
||||||
|
json-file
|
||||||
yaml-file))
|
yaml-file))
|
||||||
|
|
||||||
;; XXX: ‘substitute*’ doesn't fully support Unicode:
|
;; XXX: ‘substitute*’ doesn't fully support Unicode:
|
||||||
@ -67,6 +69,17 @@ format."
|
|||||||
(call-with-output-file #$output
|
(call-with-output-file #$output
|
||||||
(cut scm->ini #$exp #:port <>))))))
|
(cut scm->ini #$exp #:port <>))))))
|
||||||
|
|
||||||
|
;; https://github.com/aconchillo/guile-json
|
||||||
|
(define (json-file name exp)
|
||||||
|
"Return file-like object NAME, serialized from G-expression EXP in JSON
|
||||||
|
format."
|
||||||
|
(computed-file name
|
||||||
|
(with-extensions (list guile-json-4)
|
||||||
|
#~(begin
|
||||||
|
(use-modules (srfi srfi-26) (json))
|
||||||
|
(call-with-output-file #$output
|
||||||
|
(cut scm->json #$exp <> #:pretty #t))))))
|
||||||
|
|
||||||
;; https://gitlab.com/yorgath/guile-yamlpp
|
;; https://gitlab.com/yorgath/guile-yamlpp
|
||||||
(define (yaml-file name exp)
|
(define (yaml-file name exp)
|
||||||
"Return file-like object NAME, serialized from G-expression EXP in YAML
|
"Return file-like object NAME, serialized from G-expression EXP in YAML
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user