refactor(flake): pass assembly namespace to modules

This commit is contained in:
2026-08-28 11:09:13 -04:00
parent 3f24669f78
commit 64d22473c3
11 changed files with 35 additions and 36 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 `dotfiles.lib` for library functions passed through module arguments.
Use `dotfiles.mk<Name>` for assembly functions passed through module arguments.
Use `flake.lib` for library functions passed through module arguments.
Use `flake.mk<Name>` for assembly functions passed through module arguments.
Avoid:
```nix
{
lib = dotfilesFunctions;
lib = projectFunctions;
}
```
@@ -26,26 +26,26 @@ Use:
```nix
{
lib = nixpkgs.lib;
dotfiles.lib = dotfilesFunctions;
flake.lib = projectFunctions;
}
```
### Name project function namespaces by role
Put pure project functions under `dotfiles.lib`.
Put functions that create modules, systems, or assembly values under `dotfiles`.
Put pure project functions under `flake.lib`.
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
dotfiles.lib.mkGuest { name = "sample"; }
flake.lib.mkGuest { name = "sample"; }
```
Use:
```nix
dotfiles.mkGuest { name = "sample"; }
flake.mkGuest { name = "sample"; }
```
## File Placement