lib: add inPureEvalMode
This makes a value that is true if builtins does not contain the currentSystem function, but false if it does.
This commit is contained in:
parent
70b3cbff57
commit
4d9801a78f
2 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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