docs(nix): use real flake namespace example
This commit is contained in:
22
docs/nix.md
22
docs/nix.md
@@ -16,17 +16,29 @@ Use `flake.mk<Name>` for assembly functions passed through module arguments.
|
|||||||
Avoid:
|
Avoid:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
specialArgs = {
|
||||||
lib = projectFunctions;
|
lib = flakeLib;
|
||||||
}
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
Use:
|
Use:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
specialArgs = {
|
||||||
|
inherit flake;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Then call project functions through `flake` inside modules:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
lib = nixpkgs.lib;
|
flake,
|
||||||
flake.lib = projectFunctions;
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
networking.networkmanager.unmanaged = [ "interface-name:${flake.lib.bridgeName 10}" ];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user