about summary refs log tree commit diff
path: root/src/libstore/storeexpr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-10-25T14·38+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-10-25T14·38+0000
commitf4d44a002688262d33093494a7fea1bb11b97ac9 (patch)
tree9768179865220106bd1c0103361ded0967c059c8 /src/libstore/storeexpr.cc
parent3ade3e7721df981614bbb2420baeb84e58085967 (diff)
* Allow certain operations to succeed even if we don't have write
  permission to the Nix store or database.  E.g., `nix-env -qa' will
  work, but `nix-env -qas' won't (the latter needs DB access).  The
  option `--readonly-mode' forces this mode; otherwise, it's only
  activated when the database cannot be opened.

Diffstat (limited to 'src/libstore/storeexpr.cc')
-rw-r--r--src/libstore/storeexpr.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstore/storeexpr.cc b/src/libstore/storeexpr.cc
index 45b5af055a9b..29f271de884b 100644
--- a/src/libstore/storeexpr.cc
+++ b/src/libstore/storeexpr.cc
@@ -17,7 +17,7 @@ Path writeTerm(ATerm t, const string & suffix)
     Path path = canonPath(nixStore + "/" + 
         (string) h + suffix + ".store");
 
-    if (!isValidPath(path)) {
+    if (!readOnlyMode && !isValidPath(path)) {
         char * s = ATwriteToString(t);
         if (!s) throw Error(format("cannot write aterm to `%1%'") % path);
         addTextToStore(path, string(s));