mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
nix-env: Load files in ~/.nix-defexpr on demand
So if you do "nix-env -qa -A nixos", then other channels won't be parsed/evaluated at all.
This commit is contained in:
parent
c57ed84e28
commit
07a08bddf0
3 changed files with 18 additions and 3 deletions
|
@ -131,9 +131,12 @@ static void getAllExprs(EvalState & state,
|
|||
continue;
|
||||
}
|
||||
attrs.insert(attrName);
|
||||
// FIXME: make loading lazy.
|
||||
Value & v2(*state.allocAttr(v, state.symbols.create(attrName)));
|
||||
state.evalFile(path2, v2);
|
||||
/* Load the expression on demand. */
|
||||
Value & vFun(*state.allocValue());
|
||||
Value & vArg(*state.allocValue());
|
||||
state.getBuiltin("import", vFun);
|
||||
mkString(vArg, path2);
|
||||
mkApp(*state.allocAttr(v, state.symbols.create(attrName)), vFun, vArg);
|
||||
}
|
||||
else if (S_ISDIR(st.st_mode))
|
||||
/* `path2' is a directory (with no default.nix in it);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue