Skip to content
Snippets Groups Projects
Commit 22d3587f authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

* 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).
parent 928a7c06
No related branches found
No related tags found
No related merge requests found
......@@ -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");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment