mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
docs: make sample code valid Nix expressions
This commit is contained in:
parent
73794b4d2d
commit
317f7f1a4c
@ -160,7 +160,9 @@ rec {
|
|||||||
A fixed-point function returning an attribute set has the form
|
A fixed-point function returning an attribute set has the form
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
final: { # attributes }
|
final: {
|
||||||
|
# attributes
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
where `final` refers to the lazily evaluated attribute set returned by the fixed-point function.
|
where `final` refers to the lazily evaluated attribute set returned by the fixed-point function.
|
||||||
@ -168,7 +170,9 @@ rec {
|
|||||||
An overlay to such a fixed-point function has the form
|
An overlay to such a fixed-point function has the form
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
final: prev: { # attributes }
|
final: prev: {
|
||||||
|
# attributes
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
where `prev` refers to the result of the original function to `final`, and `final` is the result of the composition of the overlay and the original function.
|
where `prev` refers to the result of the original function to `final`, and `final` is the result of the composition of the overlay and the original function.
|
||||||
@ -177,8 +181,12 @@ rec {
|
|||||||
|
|
||||||
```nix
|
```nix
|
||||||
let
|
let
|
||||||
f = final: { # attributes };
|
f = final: {
|
||||||
overlay = final: prev: { # attributes };
|
# attributes
|
||||||
|
};
|
||||||
|
overlay = final: prev: {
|
||||||
|
# attributes
|
||||||
|
};
|
||||||
in extends overlay f;
|
in extends overlay f;
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -186,8 +194,12 @@ rec {
|
|||||||
|
|
||||||
```nix
|
```nix
|
||||||
let
|
let
|
||||||
f = final: { # attributes };
|
f = final: {
|
||||||
overlay = final: prev: { # attributes };
|
# attributes
|
||||||
|
};
|
||||||
|
overlay = final: prev: {
|
||||||
|
# attributes
|
||||||
|
};
|
||||||
g = extends overlay f;
|
g = extends overlay f;
|
||||||
in fix g
|
in fix g
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user