From e1c153e0ab116a174ea0ed88b76f222927048c5f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 16 Sep 2015 15:03:52 +0200 Subject: gexp: Add 'scheme-file'. * guix/gexp.scm (): 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'. --- guix/gexp.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'guix/gexp.scm') 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 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 + (($ name gexp) + (gexp->file name gexp)))) + ;;; ;;; Inputs & outputs. -- cgit v1.2.3