refactor(flake): assemble repository modules

This commit is contained in:
2026-08-28 16:16:40 -04:00
parent 0f9b639c0d
commit 81732aef84
7 changed files with 36 additions and 22 deletions

View File

@@ -10,14 +10,14 @@ Read this document with `docs/dictionary.md`.
Use `lib` only for the base `nixpkgs.lib` value.
Do not use `lib` for project functions.
Use `flake.lib` for library functions passed through module arguments.
Use `flake.util` for library functions passed through module arguments.
Use `flake.mk<Name>` for assembly functions passed through module arguments.
Avoid:
```nix
specialArgs = {
lib = flakeLib;
lib = util;
};
```
@@ -38,20 +38,20 @@ Then call project functions through `flake` inside modules:
...
}:
{
networking.networkmanager.unmanaged = [ "interface-name:${flake.lib.bridgeName 10}" ];
networking.networkmanager.unmanaged = [ "interface-name:${flake.util.bridgeName 10}" ];
}
```
### Name project function namespaces by role
Put pure project functions under `flake.lib`.
Put pure project functions under `flake.util`.
Put functions that create modules, systems, or assembly values under `flake`.
This keeps data-only functions separate from functions that carry flake context.
Avoid:
```nix
flake.lib.mkGuest { name = "sample"; }
flake.util.mkGuest { name = "sample"; }
```
Use: