diff --git a/doc/manual/nix-build.xml b/doc/manual/nix-build.xml index e26f9b1af6..dc4a5ac874 100644 --- a/doc/manual/nix-build.xml +++ b/doc/manual/nix-build.xml @@ -11,6 +11,13 @@ nix-build name value + + + + + + attrPath + drvlink diff --git a/doc/manual/nix-env.xml b/doc/manual/nix-env.xml index 5aa38c81c8..6106d15f42 100644 --- a/doc/manual/nix-env.xml +++ b/doc/manual/nix-env.xml @@ -11,6 +11,13 @@ nix-env name value + + + + + + attrPath + @@ -252,7 +259,7 @@ number of possible ways: -Examples +Examples To install a specific version of gcc from the active Nix expression: diff --git a/doc/manual/nix-instantiate.xml b/doc/manual/nix-instantiate.xml index aab2049344..5f38743081 100644 --- a/doc/manual/nix-instantiate.xml +++ b/doc/manual/nix-instantiate.xml @@ -11,6 +11,13 @@ nix-instantiate name value + + + + + + attrPath + path diff --git a/doc/manual/opt-common.xml b/doc/manual/opt-common.xml index d9c29a19e1..95e8f78d99 100644 --- a/doc/manual/opt-common.xml +++ b/doc/manual/opt-common.xml @@ -224,8 +224,8 @@ nix-build. When evaluating Nix expressions, the expression evaluator will automatically try to call functions that it encounters. It can automatically call functions for which every - argument has a default value (e.g., - {argName ? + argument has a default value + (e.g., {argName ? defaultValue}: ...). With , you can also call functions that have @@ -257,6 +257,32 @@ + / +attrPath + + In nix-env, + nix-instantiate and nix-build, + allows you to select an attribute from the + top-level Nix expression being evaluated. The attribute + path attrPath is a sequence of + attribute names separated by dots. For instance, given a top-level + Nix expression e, the attribute path + xorg.xorgserver would cause the expression + e.xorg.xorgserver to + be used. See nix-env + --install for some concrete examples. + + In addition to attribute names, you can also specify array + indices. For instance, the attribute path + foo.3.bar selects the bar + attribute of the fourth element of the array in the + foo attribute of the top-level + expression. + + + + diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index 2294fc69ae..cf590190ca 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -428,7 +428,14 @@ lrwxrwxrwx ... 2006-09-29 10:43 result -> /nix/store/632d2b22514d...-hello-2.1.1 $ ./result/bin/hello Hello, world! - +The option selects +the hello attribute from +all-packages.nix. This is faster than using the +symbolic package name specified by the name +attribute (which also happens to be hello) and is +unambiguous (there can be multiple packages with the symbolic name +hello, but there can be only one attribute in a set +named hello). nix-build registers the ./result symlink as a garbage collection root, so @@ -470,8 +477,8 @@ So it is always safe to run multiple instances of Nix in parallel If you have a system with multiple CPUs, you may want to have Nix build different derivations in parallel (insofar as possible). -Just pass the option , where +Just pass the option , where N is the maximum number of jobs to be run in parallel, or set. Typically this should be the number of CPUs.