name: pure-eval internalName: pureEval type: bool default: false
Pure evaluation mode ensures that the result of Nix expressions is fully determined by explicitly declared inputs, and not influenced by external state:
- File system and network access is restricted to accesses to immutable data only:
-
Path literals relative to the home directory like
~/lixare rejected at parse time. -
Access to absolute paths that did not result from Nix language evaluation is rejected when such paths are given as parameters to builtins like, for example,
builtins.readFile.Access is nonetheless allowed to (absolute) paths in the Nix store that are returned by builtins like
builtins.filterSource,builtins.fetchTarballand similar. -
Impure fetches such as not specifying a commit ID for
builtins.fetchGitor not specifying a hash forbuiltins.fetchTarballare rejected. -
In flakes, access to relative paths outside of the root of the flake's source tree (often, a git repository) is rejected.
-
- The evaluator ignores
NIX_PATH,-Iand thenix-pathsetting. Thus,builtins.nixPathis an empty list. - The builtins
builtins.currentSystemandbuiltins.currentTimeare absent frombuiltins. builtins.getEnvalways returns empty string for any variable.builtins.storePaththrows an error (Lix may change this, tracking issue: https://git.lix.systems/lix-project/lix/issues/402)