diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-07-19 11:23:32 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-07-19 11:23:32 +0200 |
commit | dc5f2e7da607bdf50bf710cbe0b5f6ff32980e19 (patch) | |
tree | b5a805fbcde4741ba1b0bb2c15205034344ac00b /doc | |
parent | a4921b8ceb5bde3fbd1ae25ea4b367199796eded (diff) | |
download | guix-dc5f2e7da607bdf50bf710cbe0b5f6ff32980e19.tar.gz |
nix-build --run-env: Add a ‘--pure’ flag
This causes the environment to be (almost) cleared, thus giving a shell that more closely resembled the actual Nix derivation.
Diffstat (limited to 'doc')
-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 6640898b44..61b59c1e0a 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, |