From e8e1f295f15fa56660a2c460d422795b1a31bed8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 10 Jul 2018 19:06:32 +0200 Subject: 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 (): Also allow bytevector content. (plain-file-compiler): Handle bytevector content. * doc/guix.texi (G-Expressions): Describe plain-file now also taking bytevectors. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') 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 -- cgit v1.2.3