summaryrefslogtreecommitdiffstats
path: root/lib/trivial.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r--lib/trivial.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 18616a189c26..902c56a2d0aa 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