* In nix-instantiate, at top-level, call functions that have arguments
with default values automatically. I.e., e -> e {}. This feature makes convenience expressions such as pkgs/system/i686-linux.nix in Nixpkgs obsolete, since we can just do $ nix-instantiate ./pkgs/system/all-packages.nix since all-packages.nix takes a single argument (system) that has a default value (__thisSystem).
This commit is contained in:
parent
928a7c06dc
commit
22d3587f3b
1 changed files with 17 additions and 0 deletions
|
@ -73,6 +73,23 @@ static void printDrvPaths(EvalState & state, Expr e)
|
|||
return;
|
||||
}
|
||||
|
||||
ATermList formals;
|
||||
ATerm body, pos;
|
||||
if (matchFunction(e, formals, body, pos)) {
|
||||
for (ATermIterator i(formals); i; ++i) {
|
||||
Expr name, def;
|
||||
if (matchNoDefFormal(*i, name))
|
||||
throw Error(format("expression evaluates to a function with no-default arguments (`%1%')")
|
||||
% aterm2String(name));
|
||||
else if (!matchDefFormal(*i, name, def))
|
||||
abort(); /* can't happen */
|
||||
}
|
||||
|
||||
printDrvPaths(state, evalExpr(state,
|
||||
makeCall(e, makeAttrs(ATermMap()))));
|
||||
return;
|
||||
}
|
||||
|
||||
throw Error("expression does not evaluate to one or more derivations");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue