diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-10-05T09·08+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-10-05T09·08+0000 |
commit | 5d769de8a34474f4e76911927118312b69b47136 (patch) | |
tree | 59a2f5584b288b370fbaebc62ef43dad6dead39a /doc/manual/opt-common.xml | |
parent | 6f2bfd92b695a31b35d8d515cd4ee12f9fc2c786 (diff) |
* Document --arg.
Diffstat (limited to 'doc/manual/opt-common.xml')
-rw-r--r-- | doc/manual/opt-common.xml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/manual/opt-common.xml b/doc/manual/opt-common.xml index 04cda15310fb..d9c29a19e11e 100644 --- a/doc/manual/opt-common.xml +++ b/doc/manual/opt-common.xml @@ -217,6 +217,46 @@ </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> |