diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-06-03 11:45:27 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-06-03 11:47:36 +0200 |
commit | 558e8b11d77ed79c1ae0baf5fda66cfc083bab4b (patch) | |
tree | 0ce333a9bea9554192c9c26b8ec0b6cb114383ab /guix/gexp.scm | |
parent | 74d441abeee257f5d7ec5bb5fa0db70bd26802b7 (diff) | |
download | gnu-guix-558e8b11d77ed79c1ae0baf5fda66cfc083bab4b.tar gnu-guix-558e8b11d77ed79c1ae0baf5fda66cfc083bab4b.tar.gz |
gexp: Add 'plain-file'.
* guix/gexp.scm (<plain-file>): New type.
(plain-file, plain-file-compiler): New procedures.
* tests/gexp.scm ("one plain file"): New test.
* doc/guix.texi (G-Expressions): Document 'plain-file'.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r-- | guix/gexp.scm | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index 03b4cbf19e..10056e5a1f 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -31,12 +31,18 @@ gexp-input gexp-input? + local-file local-file? local-file-file local-file-name local-file-recursive? + plain-file + plain-file? + plain-file-name + plain-file-content + gexp->derivation gexp->file gexp->script @@ -140,7 +146,7 @@ cross-compiling.)" ;;; -;;; Local files. +;;; File declarations. ;;; (define-record-type <local-file> @@ -169,6 +175,28 @@ This is the declarative counterpart of the 'interned-file' monadic procedure." (($ <local-file> file name recursive?) (interned-file file name #:recursive? recursive?)))) +(define-record-type <plain-file> + (%plain-file name content references) + plain-file? + (name plain-file-name) ;string + (content plain-file-content) ;string + (references plain-file-references)) ;list (currently unused) + +(define (plain-file name content) + "Return an object representing a text file called NAME with the given +CONTENT (a string) to be added to the store. + +This is the declarative counterpart of 'text-file'." + ;; XXX: For now just ignore 'references' because it's not clear how to use + ;; them in a declarative context. + (%plain-file name content '())) + +(define-gexp-compiler (plain-file-compiler (file plain-file?) system target) + ;; "Compile" FILE by adding it to the store. + (match file + (($ <plain-file> name content references) + (text-file name content references)))) + ;;; ;;; Inputs & outputs. |