aboutsummaryrefslogtreecommitdiff
path: root/doc/manual
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-07-28 16:55:03 +0200
committerGitHub <noreply@github.com>2022-07-28 16:55:03 +0200
commit86fcd4f6923b3a8ccca261596b9db0d8c0a873ec (patch)
treed0427c4b07c27fc18eb346bd8b74275997c033f5 /doc/manual
parent280543933507839201547f831280faac614d0514 (diff)
parent85cdaebcd69c4f6abd15b77888f0093be9c5ada4 (diff)
Merge pull request #6845 from fricklerhandwerk/attrset
manual: set -> attribute set
Diffstat (limited to 'doc/manual')
-rw-r--r--doc/manual/src/SUMMARY.md.in2
-rw-r--r--doc/manual/src/expressions/language-values.md22
2 files changed, 13 insertions, 11 deletions
diff --git a/doc/manual/src/SUMMARY.md.in b/doc/manual/src/SUMMARY.md.in
index 9728728aa..5df4e2d75 100644
--- a/doc/manual/src/SUMMARY.md.in
+++ b/doc/manual/src/SUMMARY.md.in
@@ -33,7 +33,7 @@
- [Arguments and Variables](expressions/arguments-variables.md)
- [Building and Testing](expressions/simple-building-testing.md)
- [Generic Builder Syntax](expressions/generic-builder.md)
- - [Writing Nix Expressions](expressions/expression-language.md)
+ - [Nix Expression Language](expressions/expression-language.md)
- [Values](expressions/language-values.md)
- [Language Constructs](expressions/language-constructs.md)
- [Operators](expressions/language-operators.md)
diff --git a/doc/manual/src/expressions/language-values.md b/doc/manual/src/expressions/language-values.md
index 75ae9f2eb..abbe1fd35 100644
--- a/doc/manual/src/expressions/language-values.md
+++ b/doc/manual/src/expressions/language-values.md
@@ -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.
-## Sets
+## Attribute Sets
-Sets are really the core of the language, since ultimately the Nix
-language is all about creating derivations, which are really just sets
-of attributes to be passed to build scripts.
+Attribute sets are collections of name-value-pairs (called *attributes*) enclosed in curly brackets (`{ }`).
-Sets are just a list of name/value pairs (called *attributes*) enclosed
-in curly brackets, where each value is an arbitrary expression
-terminated by a semicolon. For example:
+Names and values are separated by an equal sign (`=`).
+Each value is an arbitrary expression terminated by a semicolon (`;`).
+
+Attributes can appear in any order.
+An attribute name may only occur once.
+
+Example:
```nix
-{ x = 123;
+{
+ x = 123;
text = "Hello";
y = f { bla = 456; };
}
```
-This defines a set with attributes named `x`, `text`, `y`. The order of
-the attributes is irrelevant. An attribute name may only occur once.
+This defines a set with attributes named `x`, `text`, `y`.
Attributes can be selected from a set using the `.` operator. For
instance,