From 0c95776c3efdc63c4b957823d4e51d851a64ed84 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 18 Jan 2018 16:37:39 +0100 Subject: [PATCH] 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"; --- release.nix | 2 +- src/libexpr/primops.cc | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/release.nix b/release.nix index 04f1f8367..bdac283cf 100644 --- a/release.nix +++ b/release.nix @@ -6,7 +6,7 @@ let - pkgs = import nixpkgs { system = "x86_64-linux"; }; + pkgs = import nixpkgs { system = builtins.currentSystem or "x86_64-linux"; }; jobs = rec { diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index e90a1da25..975f0e830 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); }