summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-04-15 12:23:30 +0200
committerLudovic Courtès <ludo@gnu.org>2019-04-15 12:24:14 +0200
commitcbd059d1017bc22723f1e5293cc8f20dea640fff (patch)
tree401d737861a07b8a83896b3b25f68580e1d86018 /doc
parent0134ebc55b324dc073b68e3d64ef0d06cfdf35ce (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.texi42
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
5413When used in the @emph{lexical scope} of a package field definition, this
5414identifier resolves to the package being defined.
5415
5416The example below shows how to add a package as a native input of itself when
5417cross-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
5431It 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
10618When used in the @emph{lexical scope} of an operating system field definition,
10619this identifier resolves to the operating system being defined.
10620
10621The example below shows how to refer to the operating system being defined in
10622the 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
10633It is an error to refer to @code{this-operating-system} outside an operating
10634system definition.
10635@end deffn
10636
10595@end deftp 10637@end deftp
10596 10638
10597@node File Systems 10639@node File Systems