nix-instantiate: Add a --no-readonly-mode flag

This allows running nix-instantiate --eval-only without performing the
evaluation in readonly mode, letting features like import from
derivation and automatic substitution of builtins.storePath paths work.

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2014-02-04 09:17:59 -05:00 committed by Eelco Dolstra
parent 0432bc52ea
commit 0c3e8a616e
2 changed files with 15 additions and 0 deletions

View file

@ -35,6 +35,7 @@
<arg choice='plain'> <arg choice='plain'>
<option>--eval-only</option> <option>--eval-only</option>
<arg><option>--strict</option></arg> <arg><option>--strict</option></arg>
<arg><option>--no-readonly-mode</option></arg>
</arg> </arg>
<arg choice='plain'><option>--find-file</option></arg> <arg choice='plain'><option>--find-file</option></arg>
</group> </group>
@ -140,6 +141,17 @@ policies.</para>
</varlistentry> </varlistentry>
<varlistentry><term><option>--no-readonly-mode</option></term>
<listitem><para>When used with <option>--eval-only</option>,
perform evaluation in read/write mode so nix language features
that require it will still work (at the cost of needing to do
instantiation of every evaluated derivation).</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
<variablelist condition="manpage"> <variablelist condition="manpage">

View file

@ -107,6 +107,9 @@ void run(Strings args)
settings.readOnlyMode = true; settings.readOnlyMode = true;
evalOnly = true; evalOnly = true;
} }
else if (arg == "--no-readonly-mode") {
settings.readOnlyMode = false;
}
else if (arg == "--parse-only") { else if (arg == "--parse-only") {
settings.readOnlyMode = true; settings.readOnlyMode = true;
parseOnly = evalOnly = true; parseOnly = evalOnly = true;