diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-09-08 22:44:26 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-10-10 22:46:14 +0200 |
commit | 15a01c72209b2d43239fe7516a22e531b7fcb85f (patch) | |
tree | efa0f72643c6b53a75966957eef524eeae712072 /guix/gexp.scm | |
parent | 919370291f4f9cc93878eea7db11013949ee8473 (diff) | |
download | gnu-guix-15a01c72209b2d43239fe7516a22e531b7fcb85f.tar gnu-guix-15a01c72209b2d43239fe7516a22e531b7fcb85f.tar.gz |
gexp: Add 'program-file'.
* guix/gexp.scm (<program-file>): New record type.
(program-file, program-file-compiler): New procedures.
* tests/gexp.scm ("program-file"): New test.
* doc/guix.texi (G-Expressions): Document it.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r-- | guix/gexp.scm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index ebb147d7db..10acf2ba1b 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -50,6 +50,13 @@ computed-file-modules computed-file-options + program-file + program-file? + program-file-name + program-file-gexp + program-file-modules + program-file-guile + gexp->derivation gexp->file gexp->script @@ -247,6 +254,32 @@ This is the declarative counterpart of 'gexp->derivation'." (($ <computed-file> name gexp modules options) (apply gexp->derivation name gexp #:modules modules options)))) +(define-record-type <program-file> + (%program-file name gexp modules guile) + program-file? + (name program-file-name) ;string + (gexp program-file-gexp) ;gexp + (modules program-file-modules) ;list of module names + (guile program-file-guile)) ;package + +(define* (program-file name gexp + #:key (modules '()) (guile #f)) + "Return an object representing the executable store item NAME that runs +GEXP. GUILE is the Guile package used to execute that script, and MODULES is +the list of modules visible to that script. + +This is the declarative counterpart of 'gexp->script'." + (%program-file name gexp modules guile)) + +(define-gexp-compiler (program-file-compiler (file program-file?) + system target) + ;; Compile FILE by returning a derivation that builds the script. + (match file + (($ <program-file> name gexp modules guile) + (gexp->script name gexp + #:modules modules + #:guile (or guile (default-guile)))))) + ;;; ;;; Inputs & outputs. |