aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-11-28 15:25:42 +0100
committerLudovic Courtès <ludo@gnu.org>2015-11-28 15:28:44 +0100
commitf6c9fb1b38732fab867db086b0527b01adb03dce (patch)
treeee496fb464cf560116bb8f2ea83321352c7a85e4
parentae4427e3f39a32094ced6206ae4bcd12683f9127 (diff)
downloadguix-f6c9fb1b38732fab867db086b0527b01adb03dce.tar
guix-f6c9fb1b38732fab867db086b0527b01adb03dce.tar.gz
doc: Mention 'specification->package'.
Suggested by Florian Paul Schmidt <mista.tapas@gmx.net>. * doc/guix.texi (Using the Configuration System): Mention 'specification->package'.
-rw-r--r--doc/guix.texi20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index ab1e4be20f..f7adfafe54 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -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}).