summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/default.nix2
-rw-r--r--lib/trivial.nix7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 22eb5440c28..e9d54e476d9 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -74,7 +74,7 @@ let
       info showWarnings nixpkgsVersion version isInOldestRelease
       mod compare splitByAndCompare
       functionArgs setFunctionArgs isFunction toFunction
-      toHexString toBaseDigits;
+      toHexString toBaseDigits inPureEvalMode;
     inherit (self.fixedPoints) fix fix' converge extends composeExtensions
       composeManyExtensions makeExtensible makeExtensibleWithCustomName;
     inherit (self.attrsets) attrByPath hasAttrByPath setAttrByPath
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 18616a189c2..902c56a2d0a 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -229,6 +229,13 @@ rec {
   */
   inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";
 
+  /* Determine whether the function is being called from inside pure-eval mode
+     by seeing whether `builtins` contains `currentSystem`. If not, we must be in
+     pure-eval mode.
+
+     Type: inPureEvalMode :: bool
+  */
+  inPureEvalMode = ! builtins ? currentSystem;
 
   ## Integer operations