Merge pull request #157480 from MatthewCroughan/in-pure-eval-mode
lib: add inPureEvalMode
This commit is contained in:
commit
b37801bc3f
2 changed files with 8 additions and 1 deletions
|
@ -71,7 +71,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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue