diff options
Diffstat (limited to 'doc/manual/nix-build.xml')
-rw-r--r-- | doc/manual/nix-build.xml | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/doc/manual/nix-build.xml b/doc/manual/nix-build.xml index 6640898b44cd..61b59c1e0adc 100644 --- a/doc/manual/nix-build.xml +++ b/doc/manual/nix-build.xml @@ -42,6 +42,7 @@ <option>--run-env</option> <arg><option>--command</option> <replaceable>cmd</replaceable></arg> <arg><option>--exclude</option> <replaceable>regexp</replaceable></arg> + <arg><option>--pure</option></arg> </arg> <arg choice='plain' rep='repeat'><replaceable>paths</replaceable></arg> </cmdsynopsis> @@ -147,7 +148,10 @@ also <xref linkend="sec-common-options" />.</phrase></para> <listitem><para>In the environment of the derivation, run the shell command <replaceable>cmd</replaceable> instead of starting - an interactive shell.</para></listitem> + an interactive shell. However, if you end the shell command with + <literal>return</literal>, you still get an interactive shell. + This can be useful for doing any additional + initialisation.</para></listitem> </varlistentry> @@ -159,6 +163,21 @@ also <xref linkend="sec-common-options" />.</phrase></para> </varlistentry> + <varlistentry><term><option>--pure</option></term> + + <listitem><para>If this flag is specified, the environment is + almost entirely cleared before the interactive shell is started, + so you get an environment that more closely corresponds to the + “real” Nix build. A few variables, in particular + <envar>HOME</envar>, <envar>USER</envar> and + <envar>DISPLAY</envar>, are retained. Note that + <filename>~/.bashrc</filename> and (depending on your Bash + installation) <filename>/etc/bashrc</filename> are still sourced, + so any variables set there will affect the interactive + shell.</para></listitem> + + </varlistentry> + </variablelist> </refsection> @@ -189,6 +208,14 @@ $ buildPhase $ ./pan/gui/pan </screen> +To clear the environment first, and do some additional automatic +initialisation of the interactive shell: + +<screen> +$ nix-build '<nixpkgs>' --run-env -A pan --pure \ + --command 'export NIX_DEBUG=1; export NIX_CORES=8; return' +</screen> + </para> <para>If a derivation has multiple outputs, |