about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 17a04bc83390..1d0d9c6b2245 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -389,7 +389,9 @@ static Expr primToFile(EvalState & state, const ATermVector & args)
         refs.insert(*i);
     }
     
-    Path storePath = store->addTextToStore(name, contents, refs);
+    Path storePath = readOnlyMode
+        ? computeStorePathForText(name, contents)
+        : store->addTextToStore(name, contents, refs);
 
     /* Note: we don't need to add `context' to the context of the
        result, since `storePath' itself has references to the paths