Nix (language): Difference between revisions

imported>Mweinelt
Undo revision 5918 by HaoZeke (talk)
imported>L0b0
Correct and simplify link
Line 294: Line 294:


==== <code>with</code> statement ====
==== <code>with</code> statement ====
The <code>with</code> statement ([https://nixos.org/manual/nix/stable/#idm140737321918544 link to Nix manual section]) introduces an attrset's value contents into the lexical scope of into the expression which follows. This means that it brings all keys within that set (that do not already exist in an outer scope) into scope in that expression. So, you don't need to use the dot notation.
The [https://nixos.org/manual/nix/stable/#idm140737321903120 <code>with</code> statement] introduces an attrset's value contents into the lexical scope of into the expression which follows. This means that it brings all keys within that set (that do not already exist in an outer scope) into scope in that expression. So, you don't need to use the dot notation.


Example:
Example: