summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2018-07-10 19:06:32 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2018-07-12 06:22:04 +0200
commite8e1f295f15fa56660a2c460d422795b1a31bed8 (patch)
tree19101ec2bfff62539d6c67f8f2fe2db3f2c6d46e /doc
parentf3a422511f793fb6c6cfeec2bb8735965a03294a (diff)
downloadguix-e8e1f295f15fa56660a2c460d422795b1a31bed8.tar.gz
gexp: Allow bytevector as content of `plain-file'.
This allows for using a package source directly from git, doing something like

    (define (command->bytevector command)
      (let ((port (apply open-pipe* OPEN_READ command)))
        (let ((output (get-bytevector-all port)))
          (close-port port)
          output)))

    (define-public hello-git
      (package
        (name "hello")
        (version "git")
        (source (let* ((commit "stable-2.0")
                       (content (command->bytevector
                                 `("git" "archive" "--format" "tar" "--prefix"
                                   ,(string-append commit "/") ,commit)))
                       (file-name (string-append "hello-" commit)))
                  (plain-file file-name content)))
        ...
        ))

* guix/gexp.scm (<plain-file>): Also allow bytevector content.
(plain-file-compiler): Handle bytevector content.
* doc/guix.texi (G-Expressions): Describe plain-file now also taking
bytevectors.
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi2
1 files changed, 1 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 6900717059..8b286e9d8e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5355,7 +5355,7 @@ procedure (@pxref{The Store Monad, @code{interned-file}}).
 
 @deffn {Scheme Procedure} plain-file @var{name} @var{content}
 Return an object representing a text file called @var{name} with the given
-@var{content} (a string) to be added to the store.
+@var{content} (a string or a bytevector) to be added to the store.
 
 This is the declarative counterpart of @code{text-file}.
 @end deffn