docs(nix): remove premature let scope rule
This commit is contained in:
35
docs/nix.md
35
docs/nix.md
@@ -154,41 +154,6 @@ in
|
||||
lib.genAttrs hostNames mkHost
|
||||
```
|
||||
|
||||
### Keep bindings in the smallest scope
|
||||
|
||||
Place a `let` binding inside the expression that consumes it.
|
||||
|
||||
Avoid:
|
||||
|
||||
```nix
|
||||
let
|
||||
hostNames = lib.attrNames hosts;
|
||||
in
|
||||
{
|
||||
hostSummary = {
|
||||
inherit hostNames;
|
||||
count = lib.length hostNames;
|
||||
};
|
||||
nixosConfigurations = flakeAssembly.mkHosts (self + "/hosts");
|
||||
}
|
||||
```
|
||||
|
||||
Use:
|
||||
|
||||
```nix
|
||||
{
|
||||
hostSummary =
|
||||
let
|
||||
hostNames = lib.attrNames hosts;
|
||||
in
|
||||
{
|
||||
inherit hostNames;
|
||||
count = lib.length hostNames;
|
||||
};
|
||||
nixosConfigurations = flakeAssembly.mkHosts (self + "/hosts");
|
||||
}
|
||||
```
|
||||
|
||||
## Standard Library Calls
|
||||
|
||||
### Qualify standard library calls in flake assembly
|
||||
|
||||
Reference in New Issue
Block a user