diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-03-06 11:25:43 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-03-12 18:32:15 +0100 |
commit | cf2ac04f13d9266c7c8a2ebd2e85ef593231ac9d (patch) | |
tree | 409921980504c7138e4dac8769823fb50becc516 /doc | |
parent | be78906592c761aa2a67e979074561e459efdcac (diff) | |
download | guix-cf2ac04f13d9266c7c8a2ebd2e85ef593231ac9d.tar.gz |
gexp: Add 'with-parameters'.
* guix/gexp.scm (<parameterized>): 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.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/guix.texi | 19 |
1 files changed, 19 insertions, 0 deletions
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 |