1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

nix build: Use Nix search path

That is, unless --file is specified, the Nix search path is
synthesized into an attribute set. Thus you can say

  $ nix build nixpkgs.hello

assuming $NIX_PATH contains an entry of the form "nixpkgs=...". This
is more verbose than

  $ nix build hello

but is less ambiguous.
This commit is contained in:
Eelco Dolstra 2016-08-23 17:11:19 +02:00
parent 22d6e31fc6
commit d74236d1f2
5 changed files with 57 additions and 13 deletions

View file

@ -128,9 +128,8 @@ static void getAllExprs(EvalState & state,
}
attrs.insert(attrName);
/* Load the expression on demand. */
Value & vFun(*state.allocValue());
Value & vFun = state.getBuiltin("import");
Value & vArg(*state.allocValue());
state.getBuiltin("import", vFun);
mkString(vArg, path2);
if (v.attrs->size() == v.attrs->capacity())
throw Error(format("too many Nix expressions in directory %1%") % path);