about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-12-09T17·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-12-09T17·45+0000
commitbcd6cdf0d8d52bb5d459911bc552260d67c1bb38 (patch)
treefe1dd4e50a996006aa1ded48a0359f9b2c94525a /src
parent13618b191e923a7ccc861a46be378fd85b0c8412 (diff)
* Give a better error message when trying to build something and
  readOnlyMode is set.

Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 61b7d33261d9..2e0f166d4f9d 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -796,6 +796,9 @@ void DerivationGoal::init()
 {
     trace("init");
 
+    if (readOnlyMode)
+        throw Error(format("cannot build derivation `%1%' - no write access to the Nix store") % drvPath);
+
     /* The first thing to do is to make sure that the derivation
        exists.  If it doesn't, it may be created through a
        substitute. */
@@ -2122,6 +2125,9 @@ void SubstitutionGoal::init()
         return;
     }
 
+    if (readOnlyMode)
+        throw Error(format("cannot substitute path `%1%' - no write access to the Nix store") % storePath);
+
     subs = substituters;
     
     tryNext();