From cf2ac04f13d9266c7c8a2ebd2e85ef593231ac9d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 6 Mar 2020 11:25:43 +0100 Subject: gexp: Add 'with-parameters'. * guix/gexp.scm (): New record type. (with-parameters): New macro. (compile-parameterized): New gexp compiler. * tests/gexp.scm ("with-parameters for %current-system") ("with-parameters for %current-target-system") ("with-parameters + file-append"): New tests. * doc/guix.texi (G-Expressions): Document it. --- doc/guix.texi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index dd32b65fe0..4f8f7cfb2a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8022,6 +8022,25 @@ the second case, the resulting script contains a @code{(string-append @dots{})} expression to construct the file name @emph{at run time}. @end deffn +@deffn {Scheme Syntax} with-parameters ((@var{parameter} @var{value}) @dots{}) @var{exp} +This macro is similar to the @code{parameterize} form for +dynamically-bound @dfn{parameters} (@pxref{Parameters,,, guile, GNU +Guile Reference Manual}). The key difference is that it takes effect +when the file-like object returned by @var{exp} is lowered to a +derivation or store item. + +A typical use of @code{with-parameters} is to force the system in effect +for a given object: + +@lisp +(with-parameters ((%current-system "i686-linux")) + coreutils) +@end lisp + +The example above returns an object that corresponds to the i686 build +of Coreutils, regardless of the current value of @code{%current-system}. +@end deffn + Of course, in addition to gexps embedded in ``host'' code, there are also modules containing build tools. To make it clear that they are -- cgit v1.2.3