Merge pull request #157480 from MatthewCroughan/in-pure-eval-mode

lib: add inPureEvalMode
This commit is contained in:
Robert Hensing 2022-06-10 16:31:31 +02:00 committed by GitHub
commit b37801bc3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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