mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +02:00
doc: clarify release notes about nested attribute merges
This commit is contained in:
parent
ae3a7d6eba
commit
1b756e300f
1 changed files with 16 additions and 3 deletions
|
@ -11,8 +11,12 @@
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
nested = { foo = 1; };
|
nested = {
|
||||||
nested = { ${"ba" + "r"} = 2; };
|
foo = 1;
|
||||||
|
};
|
||||||
|
nested = {
|
||||||
|
${"ba" + "r"} = 2;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -22,8 +26,17 @@
|
||||||
{ nested = { bar = 2; foo = 1; }; }
|
{ nested = { bar = 2; foo = 1; }; }
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the feature of merging multiple attribute set declarations is of questionable value.
|
Note that the feature of merging multiple *full declarations* of attribute sets like `nested` in the example is of questionable value.
|
||||||
It allows writing expressions that are very hard to read, for instance when there are many lines of code between two declarations of the same attribute.
|
It allows writing expressions that are very hard to read, for instance when there are many lines of code between two declarations of the same attribute.
|
||||||
This has been around for a long time and is therefore supported for backwards compatibility, but should not be relied upon.
|
This has been around for a long time and is therefore supported for backwards compatibility, but should not be relied upon.
|
||||||
|
|
||||||
|
Instead, consider using the *nested attribute path* syntax:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
nested.foo = 1;
|
||||||
|
nested.${"ba" + "r"} = 2;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
* Tarball flakes can now redirect to an "immutable" URL that will be recorded in lock files. This allows the use of "mutable" tarball URLs like `https://example.org/hello/latest.tar.gz` in flakes. See the [tarball fetcher](../protocols/tarball-fetcher.md) for details.
|
* Tarball flakes can now redirect to an "immutable" URL that will be recorded in lock files. This allows the use of "mutable" tarball URLs like `https://example.org/hello/latest.tar.gz` in flakes. See the [tarball fetcher](../protocols/tarball-fetcher.md) for details.
|
||||||
|
|
Loading…
Reference in a new issue