Add an option ‘use-binary-caches’

This allows disabling the use of binary caches, e.g.

  $ nix-build ... --option use-binary-caches false

Note that

  $ nix-build ... --option binary-caches ''

does not disable all binary caches, since the caches defined by
channels will still be used.
This commit is contained in:
Eelco Dolstra 2012-11-06 13:44:59 +01:00
parent df27db712d
commit 620e92e880
2 changed files with 14 additions and 0 deletions

View file

@ -318,6 +318,16 @@ build-use-chroot = /dev /proc /bin</programlisting>
</varlistentry> </varlistentry>
<varlistentry><term><literal>use-binary-caches</literal></term>
<listitem><para>If set to <literal>true</literal> (the default),
Nix will check the binary caches specified by
<option>binary-caches</option> and related options to obtain
binary substitutes.</para></listitem>
</varlistentry>
<varlistentry><term><literal>binary-caches</literal></term> <varlistentry><term><literal>binary-caches</literal></term>
<listitem><para>A list of URLs of binary caches, separated by <listitem><para>A list of URLs of binary caches, separated by

View file

@ -177,6 +177,10 @@ sub getAvailableCaches {
return if $gotCaches; return if $gotCaches;
$gotCaches = 1; $gotCaches = 1;
return if
($Nix::Config::config{"use-binary-caches"} // "true") eq "false" ||
($Nix::Config::config{"untrusted-use-binary-caches"} // "true") eq "false";
sub strToList { sub strToList {
my ($s) = @_; my ($s) = @_;
return map { s/\/+$//; $_ } split(/ /, $s); return map { s/\/+$//; $_ } split(/ /, $s);