about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-13T16·11-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-13T16·11-0400
commitc845c0ccad9a835a69c63c2eadd71d7845dca111 (patch)
tree128aef698dbc6bc0b3c187015a5d1af6c0c5dba1
parentb14717ab9003452fda7afe0f9627673b9f331569 (diff)
nix-channel: Add option to force fetching of manifests
-rw-r--r--doc/manual/conf-file.xml12
-rwxr-xr-xscripts/nix-channel.in7
2 files changed, 19 insertions, 0 deletions
diff --git a/doc/manual/conf-file.xml b/doc/manual/conf-file.xml
index 82bc025bcd74..f56cc27264c1 100644
--- a/doc/manual/conf-file.xml
+++ b/doc/manual/conf-file.xml
@@ -364,6 +364,18 @@ build-use-chroot = /dev /proc /bin</programlisting>
   </varlistentry>
 
 
+  <varlistentry><term><literal>force-manifest</literal></term>
+
+    <listitem><para>If this option is set to <literal>false</literal>
+    (default) and a Nix channel provides both a manifest and a binary
+    cache, only the binary cache will be used.  If set to
+    <literal>true</literal>, the manifest will be fetched as well.
+    This is useful if you want to use binary patches (which are
+    currently not supported by binary caches).</para></listitem>
+
+  </varlistentry>
+
+
   <varlistentry><term><literal>system</literal></term>
 
     <listitem><para>This option specifies the canonical Nix system
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index 7e50dac1e3a9..61ac823eb1f6 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -6,6 +6,8 @@ use File::Path qw(mkpath);
 use Nix::Config;
 use Nix::Manifest;
 
+Nix::Config::readConfig;
+
 my $manifestDir = $Nix::Config::manifestDir;
 
 
@@ -102,10 +104,15 @@ sub update {
         # Check if the channel advertises a binary cache.
         my $binaryCacheURL = `$Nix::Config::curl --silent '$url'/binary-cache-url`;
         my $extraAttrs = "";
+        my $getManifest = ($Nix::Config::config{"force-manifest"} // "false") eq "true";
         if ($? == 0 && $binaryCacheURL ne "") {
             $extraAttrs .= "binaryCacheURL = \"$binaryCacheURL\"; ";
             deleteOldManifests($origUrl, undef);
         } else {
+            $getManifest = 1;
+        }
+
+        if ($getManifest) {
             # No binary cache, so pull the channel manifest.
             mkdir $manifestDir, 0755 unless -e $manifestDir;
             die "$0: you do not have write permission to `$manifestDir'!\n" unless -W $manifestDir;