about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-01-18T15·37+0100
committerEelco Dolstra <edolstra@gmail.com>2018-01-18T15·38+0100
commit0c95776c3efdc63c4b957823d4e51d851a64ed84 (patch)
treecb06e2336002f760ce0bba427f1c859e7a6ec4e6 /src/libexpr
parent5647e55f65a69bfb4a44fb2dfb6d7fd870b4dd38 (diff)
Don't define builtins.{currentSystem,currentTime} in pure mode
This makes it easier to provide a default, e.g.

  system = builtins.currentSystem or "x86_64-linux";
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/primops.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index e90a1da25e0b..975f0e8309e6 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1997,16 +1997,12 @@ void EvalState::createBaseEnv()
         addConstant(name, v);
     };
 
-    if (settings.pureEval)
-        addPurityError("__currentTime");
-    else {
+    if (!settings.pureEval) {
         mkInt(v, time(0));
         addConstant("__currentTime", v);
     }
 
-    if (settings.pureEval)
-        addPurityError("__currentSystem");
-    else {
+    if (!settings.pureEval) {
         mkString(v, settings.thisSystem);
         addConstant("__currentSystem", v);
     }