mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
* Added syntactic sugar to the construction of attribute sets to
`inherit' variables from the surrounding lexical scope. E.g., {stdenv, libfoo}: derivation { builder = ./bla; inherit stdenv libfoo; xyzzy = 1; } is equivalent to {stdenv, libfoo}: derivation { builder = ./bla; stdenv = stdenv; libfoo = libfoo; xyzzy = 1; } Note that for mutually recursive attribute set definitions (`rec {...}'), this also works, that is, `rec {inherit x;}' is equivalent to `let {fresh = x; body = rec {x = fresh;};}', *not* `rec {x = x}'.
This commit is contained in:
parent
d9f30fe7c7
commit
1c9c0a5a46
6 changed files with 78 additions and 41 deletions
|
@ -96,7 +96,7 @@ static string processBinding(EvalState & state, Expr e, StoreExpr & ne)
|
|||
return st.str();
|
||||
}
|
||||
|
||||
if (atMatch(m, e) >> "Attrs" >> es) {
|
||||
if (atMatch(m, e) >> "Attrs") {
|
||||
Expr a = queryAttr(e, "type");
|
||||
if (a && evalString(state, a) == "derivation") {
|
||||
a = queryAttr(e, "drvPath");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue