aboutsummaryrefslogtreecommitdiff
path: root/tw/gexp.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tw/gexp.scm')
-rw-r--r--tw/gexp.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/tw/gexp.scm b/tw/gexp.scm
index 2f1705b7..0770f250 100644
--- a/tw/gexp.scm
+++ b/tw/gexp.scm
@@ -1,4 +1,5 @@
(define-module (tw gexp)
+ #:use-module (gnu packages guile)
#:use-module (guix gexp)
#:use-module (guix modules))
@@ -19,3 +20,11 @@
(lambda (iport)
(dump-port iport oport))))
'#$files)))))))
+
+(define-public (json-file name value)
+ (computed-file name
+ (with-extensions (list guile-json-4)
+ #~(begin
+ (use-modules (json) (srfi srfi-26))
+ (call-with-output-file #$output
+ (cut scm->json '#$value <> #:unicode #t))))))