manual: set -> attribute set
reword description to have shorter sentences.
This commit is contained in:
parent
be4654c344
commit
85cdaebcd6
1 changed files with 12 additions and 10 deletions
|
@ -172,25 +172,27 @@ function and the fifth being a set.
|
||||||
|
|
||||||
Note that lists are only lazy in values, and they are strict in length.
|
Note that lists are only lazy in values, and they are strict in length.
|
||||||
|
|
||||||
## Sets
|
## Attribute Sets
|
||||||
|
|
||||||
Sets are really the core of the language, since ultimately the Nix
|
Attribute sets are collections of name-value-pairs (called *attributes*) enclosed in curly brackets (`{ }`).
|
||||||
language is all about creating derivations, which are really just sets
|
|
||||||
of attributes to be passed to build scripts.
|
|
||||||
|
|
||||||
Sets are just a list of name/value pairs (called *attributes*) enclosed
|
Names and values are separated by an equal sign (`=`).
|
||||||
in curly brackets, where each value is an arbitrary expression
|
Each value is an arbitrary expression terminated by a semicolon (`;`).
|
||||||
terminated by a semicolon. For example:
|
|
||||||
|
Attributes can appear in any order.
|
||||||
|
An attribute name may only occur once.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ x = 123;
|
{
|
||||||
|
x = 123;
|
||||||
text = "Hello";
|
text = "Hello";
|
||||||
y = f { bla = 456; };
|
y = f { bla = 456; };
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This defines a set with attributes named `x`, `text`, `y`. The order of
|
This defines a set with attributes named `x`, `text`, `y`.
|
||||||
the attributes is irrelevant. An attribute name may only occur once.
|
|
||||||
|
|
||||||
Attributes can be selected from a set using the `.` operator. For
|
Attributes can be selected from a set using the `.` operator. For
|
||||||
instance,
|
instance,
|
||||||
|
|
Loading…
Reference in a new issue