diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-09-07 22:37:14 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-10-10 22:46:14 +0200 |
commit | 919370291f4f9cc93878eea7db11013949ee8473 (patch) | |
tree | cd86c3cf59adc2d07e398ad6779a62de0c09d7f9 /guix/gexp.scm | |
parent | a72ccbc25125d0d14cabdc1b0f824f27bb64478b (diff) | |
download | patches-919370291f4f9cc93878eea7db11013949ee8473.tar patches-919370291f4f9cc93878eea7db11013949ee8473.tar.gz |
gexp: Add 'computed-file'.
* guix/gexp.scm (<computed-file>): New record type.
(computed-file, computed-file-compiler): New procedures.
* tests/gexp.scm ("lower-object, computed-file"): New test.
* doc/guix.texi (G-Expressions): Document 'computed-file'.
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 de49fef088..ebb147d7db 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -43,6 +43,13 @@ plain-file-name plain-file-content + computed-file + computed-file? + computed-file-name + computed-file-gexp + computed-file-modules + computed-file-options + gexp->derivation gexp->file gexp->script @@ -214,6 +221,32 @@ This is the declarative counterpart of 'text-file'." (($ <plain-file> name content references) (text-file name content references)))) +(define-record-type <computed-file> + (%computed-file name gexp modules options) + computed-file? + (name computed-file-name) ;string + (gexp computed-file-gexp) ;gexp + (modules computed-file-modules) ;list of module names + (options computed-file-options)) ;list of arguments + +(define* (computed-file name gexp + #:key (modules '()) (options '(#:local-build? #t))) + "Return an object representing the store item NAME, a file or directory +computed by GEXP. MODULES specifies the set of modules visible in the +execution context of GEXP. OPTIONS is a list of additional arguments to pass +to 'gexp->derivation'. + +This is the declarative counterpart of 'gexp->derivation'." + (%computed-file name gexp modules options)) + +(define-gexp-compiler (computed-file-compiler (file computed-file?) + system target) + ;; Compile FILE by returning a derivation whose build expression is its + ;; gexp. + (match file + (($ <computed-file> name gexp modules options) + (apply gexp->derivation name gexp #:modules modules options)))) + ;;; ;;; Inputs & outputs. |