summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-16 15:03:52 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-10 22:46:15 +0200
commite1c153e0ab116a174ea0ed88b76f222927048c5f (patch)
tree20f3bad7cf98e82d8f6b4652279d4278e9001c0e /guix
parentb893f1aec35b879169f80bc9461fac21907fbaf4 (diff)
gexp: Add 'scheme-file'.
* guix/gexp.scm (<scheme-file>): New record type. (scheme-file, scheme-file-compiler): New procedures. * tests/gexp.scm ("scheme-file"): New test. * doc/guix.texi (G-Expressions): Document 'scheme-file'.
Diffstat (limited to 'guix')
-rw-r--r--guix/gexp.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index f44df9c6ea..27bccc6206 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -57,6 +57,11 @@
program-file-modules
program-file-guile
+ scheme-file
+ scheme-file?
+ scheme-file-name
+ scheme-file-gexp
+
gexp->derivation
gexp->file
gexp->script
@@ -281,6 +286,25 @@ This is the declarative counterpart of 'gexp->script'."
#:modules modules
#:guile (or guile (default-guile))))))
+(define-record-type <scheme-file>
+ (%scheme-file name gexp)
+ scheme-file?
+ (name scheme-file-name) ;string
+ (gexp scheme-file-gexp)) ;gexp
+
+(define* (scheme-file name gexp)
+ "Return an object representing the Scheme file NAME that contains GEXP.
+
+This is the declarative counterpart of 'gexp->file'."
+ (%scheme-file name gexp))
+
+(define-gexp-compiler (scheme-file-compiler (file scheme-file?)
+ system target)
+ ;; Compile FILE by returning a derivation that builds the file.
+ (match file
+ (($ <scheme-file> name gexp)
+ (gexp->file name gexp))))
+
;;;
;;; Inputs & outputs.