about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-22T15·23+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-22T15·23+0000
commiteda2c3c2537562e3b18c02a47b19e47ba3d37598 (patch)
tree0bd65e02bb0fe09cf37501896b857b7a63951961 /src/libstore
parent3c1630131e26efc90164bd8ca57870d9c4ad402b (diff)
* Compatibility hack so that Nixpkgs can continue to do hash checking
  in `fetchurl' in Nix <= 0.7, but doesn't in Nix 0.8.

Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 2dd8caf15af7..1ba521eb37e3 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -989,6 +989,15 @@ void DerivationGoal::startBuilder()
     /* Also set TMPDIR and variants to point to this directory. */
     env["TMPDIR"] = env["TEMPDIR"] = env["TMP"] = env["TEMP"] = tmpDir;
 
+    /* Compatibility hack with Nix <= 0.7: if this is a fixed-output
+       derivation, tell the builder, so that for instance `fetchurl'
+       can skip checking the output.  On older Nixes, this environment
+       variable won't be set, so `fetchurl' will do the check. */
+    for (DerivationOutputs::iterator i = drv.outputs.begin(); 
+         i != drv.outputs.end(); ++i)
+        if (i->second.hash != "")
+            env["NIX_OUTPUT_CHECKED"] = "1";
+
     /* Run the builder. */
     printMsg(lvlChatty, format("executing builder `%1%'") %
         drv.builder);