diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-04-15 12:23:30 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-04-15 12:24:14 +0200 |
| commit | cbd059d1017bc22723f1e5293cc8f20dea640fff (patch) | |
| tree | 401d737861a07b8a83896b3b25f68580e1d86018 /doc | |
| parent | 0134ebc55b324dc073b68e3d64ef0d06cfdf35ce (diff) | |
doc: Document 'this-package' and 'this-operating-system'.
* doc/guix.texi (package Reference): Document 'this-package'.
(operating-system Reference): Document 'this-operating-system'.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/guix.texi | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 1ae5711c023..4593d793b4a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -5409,6 +5409,27 @@ automatically corrected. | |||
| 5409 | @end table | 5409 | @end table |
| 5410 | @end deftp | 5410 | @end deftp |
| 5411 | 5411 | ||
| 5412 | @deffn {Scheme Syntax} this-package | ||
| 5413 | When used in the @emph{lexical scope} of a package field definition, this | ||
| 5414 | identifier resolves to the package being defined. | ||
| 5415 | |||
| 5416 | The example below shows how to add a package as a native input of itself when | ||
| 5417 | cross-compiling: | ||
| 5418 | |||
| 5419 | @example | ||
| 5420 | (package | ||
| 5421 | (name "guile") | ||
| 5422 | ;; ... | ||
| 5423 | |||
| 5424 | ;; When cross-compiled, Guile, for example, depends on | ||
| 5425 | ;; a native version of itself. Add it here. | ||
| 5426 | (native-inputs (if (%current-target-system) | ||
| 5427 | `(("self" ,this-package)) | ||
| 5428 | '()))) | ||
| 5429 | @end example | ||
| 5430 | |||
| 5431 | It is an error to refer to @code{this-package} outside a package definition. | ||
| 5432 | @end deffn | ||
| 5412 | 5433 | ||
| 5413 | @node origin Reference | 5434 | @node origin Reference |
| 5414 | @subsection @code{origin} Reference | 5435 | @subsection @code{origin} Reference |
| @@ -10592,6 +10613,27 @@ is that only @code{root} and members of the @code{wheel} group may use | |||
| 10592 | @code{sudo}. | 10613 | @code{sudo}. |
| 10593 | 10614 | ||
| 10594 | @end table | 10615 | @end table |
| 10616 | |||
| 10617 | @deffn {Scheme Syntax} this-operating-system | ||
| 10618 | When used in the @emph{lexical scope} of an operating system field definition, | ||
| 10619 | this identifier resolves to the operating system being defined. | ||
| 10620 | |||
| 10621 | The example below shows how to refer to the operating system being defined in | ||
| 10622 | the definition of the @code{label} field: | ||
| 10623 | |||
| 10624 | @example | ||
| 10625 | (use-modules (gnu) (guix)) | ||
| 10626 | |||
| 10627 | (operating-system | ||
| 10628 | ;; ... | ||
| 10629 | (label (package-full-name | ||
| 10630 | (operating-system-kernel this-operating-system)))) | ||
| 10631 | @end example | ||
| 10632 | |||
| 10633 | It is an error to refer to @code{this-operating-system} outside an operating | ||
| 10634 | system definition. | ||
| 10635 | @end deffn | ||
| 10636 | |||
| 10595 | @end deftp | 10637 | @end deftp |
| 10596 | 10638 | ||
| 10597 | @node File Systems | 10639 | @node File Systems |
