From b751cde36b508690d5f893360f964d3098549131 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 9 Sep 2015 09:44:43 +0200 Subject: gexp: Add 'mixed-text-file'. * guix/gexp.scm (mixed-text-file): New procedure. * tests/gexp.scm ("mixed-text-file"): New test. * doc/guix.texi (G-Expressions): Document it. --- guix/gexp.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'guix') diff --git a/guix/gexp.scm b/guix/gexp.scm index 10acf2ba1b..f44df9c6ea 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -61,6 +61,7 @@ gexp->file gexp->script text-file* + mixed-text-file imported-files imported-modules compiled-modules @@ -969,6 +970,21 @@ resulting store file holds references to all these." (gexp->derivation name builder)) +(define* (mixed-text-file name #:rest text) + "Return an object representing store file NAME containing TEXT. TEXT is a +sequence of strings and file-like objects, as in: + + (mixed-text-file \"profile\" + \"export PATH=\" coreutils \"/bin:\" grep \"/bin\") + +This is the declarative counterpart of 'text-file*'." + (define build + (gexp (call-with-output-file (ungexp output "out") + (lambda (port) + (display (string-append (ungexp-splicing text)) port))))) + + (computed-file name build)) + ;;; ;;; Syntactic sugar. -- cgit v1.2.3