Skip to main content

is_pure_eval

Function is_pure_eval 

Source
pub fn is_pure_eval() -> bool
Expand description

Returns true when Nix is running in pure evaluation mode (--pure-eval).

Reads the global pure-eval Nix setting. The result reflects the setting at call time and is stable for the lifetime of a single Nix evaluation.

ยงUse in primops

primop::PrimOpRet::set_path and primop::PrimOpRet::make_path call nix_init_path_string internally, which the Nix evaluator rejects for absolute paths in pure mode. Check this function first so your primop can make the right call: return an explicit error, use a string, or refuse to run at all.