doc: Mention 'specification->package'.

Suggested by Florian Paul Schmidt <mista.tapas@gmx.net>.

* doc/guix.texi (Using the Configuration System): Mention
'specification->package'.
This commit is contained in:
Ludovic Courtès 2015-11-28 15:25:42 +01:00
parent ae4427e3f3
commit f6c9fb1b38
1 changed files with 20 additions and 0 deletions

View File

@ -5543,6 +5543,26 @@ editor, @command{find}, @command{grep}, etc. The example above adds
tcpdump to those, taken from the @code{(gnu packages admin)} module
(@pxref{Package Modules}).
@findex specification->package
Referring to packages by variable name, like @var{tcpdump} above, has
the advantage of being unambiguous; it also allows typos and such to be
diagnosed right away as ``unbound variables''. The downside is that one
needs to know which module defines which package, and to augment the
@code{use-package-modules} line accordingly. To avoid that, one can use
the @code{specification->package} procedure of the @code{(gnu packages)}
module, which returns the best package for a given name or name and
version:
@lisp
(use-modules (gnu packages))
(operating-system
;; ...
(packages (append (map specification->package
'("tcpdump" "htop" "gnupg-2.0"))
%base-packages)))
@end lisp
@vindex %base-services
The @code{services} field lists @dfn{system services} to be made
available when the system starts (@pxref{Services}).