* Document --arg.
This commit is contained in:
parent
6f2bfd92b6
commit
5d769de8a3
6 changed files with 53 additions and 15 deletions
|
@ -9,6 +9,8 @@
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-build</command>
|
<command>nix-build</command>
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||||
|
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
||||||
<arg><option>--add-drv-link</option></arg>
|
<arg><option>--add-drv-link</option></arg>
|
||||||
<arg><option>--drv-link </option><replaceable>drvlink</replaceable></arg>
|
<arg><option>--drv-link </option><replaceable>drvlink</replaceable></arg>
|
||||||
<arg><option>--no-out-link</option></arg>
|
<arg><option>--no-out-link</option></arg>
|
||||||
|
@ -56,6 +58,12 @@ or renamed. So don’t rename the symlink.</para></warning>
|
||||||
|
|
||||||
<refsection><title>Options</title>
|
<refsection><title>Options</title>
|
||||||
|
|
||||||
|
<para>See also <xref linkend="sec-common-options" />. All options not
|
||||||
|
listed here are passed to <command>nix-store --realise</command>,
|
||||||
|
except for <option>--arg</option> and <option>--attr</option> /
|
||||||
|
<option>-A</option> which are passed to
|
||||||
|
<command>nix-instantiate</command>.</para>
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry><term><option>--add-drv-link</option></term>
|
<varlistentry><term><option>--add-drv-link</option></term>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-env</command>
|
<command>nix-env</command>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||||
|
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
||||||
<arg>
|
<arg>
|
||||||
<group choice='req'>
|
<group choice='req'>
|
||||||
<arg choice='plain'><option>--file</option></arg>
|
<arg choice='plain'><option>--file</option></arg>
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
</group>
|
</group>
|
||||||
<replaceable>path</replaceable>
|
<replaceable>path</replaceable>
|
||||||
</arg>
|
</arg>
|
||||||
<arg><option>--preserve-installed</option></arg>
|
|
||||||
<arg>
|
<arg>
|
||||||
<arg choice='plain'><option>--system-filter</option></arg>
|
<arg choice='plain'><option>--system-filter</option></arg>
|
||||||
<replaceable>system</replaceable>
|
<replaceable>system</replaceable>
|
||||||
|
@ -106,19 +106,6 @@ linkend="sec-common-options" />.</para>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--preserve-installed</option></term>
|
|
||||||
|
|
||||||
<listitem><para>By default, when you install a derivation with the
|
|
||||||
<option>--install</option> operation, it will replace previously
|
|
||||||
installed versions with the same derivation name (regardless of
|
|
||||||
the version number). This option causes those previously
|
|
||||||
installed versions to be kept in the new generation of the
|
|
||||||
profile. Note that this will generally cause conflicts in the
|
|
||||||
creation of the user environment (since multiple versions of a
|
|
||||||
package typically contain the same programs).</para></listitem>
|
|
||||||
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry><term><option>--system-filter</option> <replaceable>system</replaceable></term>
|
<varlistentry><term><option>--system-filter</option> <replaceable>system</replaceable></term>
|
||||||
|
|
||||||
<listitem><para>By default, operations such as <option>--query
|
<listitem><para>By default, operations such as <option>--query
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>nix-instantiate</command>
|
<command>nix-instantiate</command>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="opt-common-syn.xml#xpointer(/nop/*)" />
|
||||||
|
<arg><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></arg>
|
||||||
<arg><option>--add-root</option> <replaceable>path</replaceable></arg>
|
<arg><option>--add-root</option> <replaceable>path</replaceable></arg>
|
||||||
<arg><option>--indirect</option></arg>
|
<arg><option>--indirect</option></arg>
|
||||||
<group choice='opt'>
|
<group choice='opt'>
|
||||||
|
|
|
@ -20,5 +20,6 @@
|
||||||
<arg><option>--fallback</option></arg>
|
<arg><option>--fallback</option></arg>
|
||||||
<arg><option>--readonly-mode</option></arg>
|
<arg><option>--readonly-mode</option></arg>
|
||||||
<arg><option>--log-type</option> <replaceable>type</replaceable></arg>
|
<arg><option>--log-type</option> <replaceable>type</replaceable></arg>
|
||||||
|
<sbr />
|
||||||
|
|
||||||
</nop>
|
</nop>
|
||||||
|
|
|
@ -217,6 +217,46 @@
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
|
<varlistentry><term><option>--arg</option> <replaceable>name</replaceable> <replaceable>value</replaceable></term>
|
||||||
|
|
||||||
|
<listitem><para>This option is accepted by
|
||||||
|
<command>nix-env</command>, <command>nix-instantiate</command> and
|
||||||
|
<command>nix-build</command>. 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.,
|
||||||
|
<literal>{<replaceable>argName</replaceable> ?
|
||||||
|
<replaceable>defaultValue</replaceable>}:
|
||||||
|
<replaceable>...</replaceable></literal>). With
|
||||||
|
<option>--arg</option>, you can also call functions that have
|
||||||
|
arguments without a default value (or override a default value).
|
||||||
|
That is, if the evaluator encounters a function with an argument
|
||||||
|
named <replaceable>name</replaceable>, it will call it with value
|
||||||
|
<replaceable>value</replaceable>.</para>
|
||||||
|
|
||||||
|
<para>For instance, the file
|
||||||
|
<literal>pkgs/top-level/all-packages.nix</literal> in Nixpkgs is
|
||||||
|
actually a function:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
{ # The system (e.g., `i686-linux') for which to build the packages.
|
||||||
|
system ? __currentSystem
|
||||||
|
<replaceable>...</replaceable>
|
||||||
|
}: <replaceable>...</replaceable></programlisting>
|
||||||
|
|
||||||
|
So if you call this Nix expression (e.g., when you do
|
||||||
|
<literal>nix-env -i <replaceable>pkgname</replaceable></literal>),
|
||||||
|
the function will be called automatically using the value <link
|
||||||
|
linkend='builtin-currentSystem'><literal>__currentSystem</literal></link>
|
||||||
|
for the <literal>system</literal> argument. You can override this
|
||||||
|
using <option>--arg</option>, e.g., <literal>nix-env -i
|
||||||
|
<replaceable>pkgname</replaceable> --arg system
|
||||||
|
\"i686-freebsd\"</literal>. (Note that since the argument is a Nix
|
||||||
|
string literal, you have to escape the quotes.)</para></listitem>
|
||||||
|
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1387,7 +1387,8 @@ if builtins ? getEnv then __getEnv "PATH" else ""</programlisting>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry><term><varname>currentSystem</varname></term>
|
<varlistentry
|
||||||
|
xml:id='builtin-currentSystem'><term><varname>builtins.currentSystem</varname></term>
|
||||||
|
|
||||||
<listitem><para>The built-in value <varname>currentSystem</varname>
|
<listitem><para>The built-in value <varname>currentSystem</varname>
|
||||||
evaluates to the Nix platform identifier for the Nix installation
|
evaluates to the Nix platform identifier for the Nix installation
|
||||||
|
|
Loading…
Reference in a new issue