mirror of
https://github.com/NixOS/nix
synced 2025-07-02 05:11:47 +02:00
Work on Values instead of Exprs
This prevents some duplicate evaluation in nix-env and nix-instantiate. Also, when traversing ~/.nix-defexpr, only read regular files with the extension .nix. Previously it was reading files like .../channels/binary-caches/<name>. The only reason this didn't cause problems is pure luck (namely, <name> shadows an actual Nix expression, the binary-caches files happen to be syntactically valid Nix expressions, and we iterate over the directory contents in just the right order).
This commit is contained in:
parent
06bb2d95b4
commit
ef4f5ba85e
4 changed files with 62 additions and 50 deletions
|
@ -44,9 +44,11 @@ void processExpr(EvalState & state, const Strings & attrPaths,
|
|||
return;
|
||||
}
|
||||
|
||||
Value vRoot;
|
||||
state.eval(e, vRoot);
|
||||
|
||||
foreach (Strings::const_iterator, i, attrPaths) {
|
||||
Value v;
|
||||
findAlongAttrPath(state, *i, autoArgs, e, v);
|
||||
Value & v(*findAlongAttrPath(state, *i, autoArgs, vRoot));
|
||||
state.forceValue(v);
|
||||
|
||||
PathSet context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue