Skip to content

Commit d88adf9

Browse files
docs: cleanup
Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
1 parent db6e039 commit d88adf9

File tree

8 files changed

+221
-196
lines changed

8 files changed

+221
-196
lines changed

docs/src/content/docs/ghaf/dev/architecture/config-propagation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Ghaf now uses `specialArgs` to inject configuration into VM modules:
5555
When evaluating NixOS modules with `evalModules`, `specialArgs` provides values that are automatically available to all modules:
5656

5757
```nix
58-
lib.evalModules {
58+
lib.nixosSystem {
5959
specialArgs = {
6060
# These become function parameters in ALL modules
6161
globalConfig = { /* ... */ };
@@ -346,7 +346,7 @@ Profiles create the specialArgs when defining VM bases:
346346
options.ghaf.profiles.laptop-x86.guivmBase = lib.mkOption {
347347
type = lib.types.unspecified;
348348
readOnly = true;
349-
default = lib.evalModules {
349+
default = lib.nixosSystem {
350350
# This is where specialArgs are created
351351
specialArgs = lib.ghaf.vm.mkSpecialArgs {
352352
inherit lib inputs;

docs/src/content/docs/ghaf/dev/architecture/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ The following diagram shows how settings flow from host to VM:
171171
┌─────────────────────────────────────────────────────────────────┐
172172
│ PROFILE (modules/profiles/laptop-x86.nix) │
173173
│ │
174-
│ guivmBase = lib.evalModules { │
174+
│ guivmBase = lib.nixosSystem { │
175175
│ specialArgs = lib.ghaf.vm.mkSpecialArgs { │
176176
│ inherit lib inputs; │
177177
│ globalConfig = config.ghaf.global-config; ◄── From host │

docs/src/content/docs/ghaf/dev/architecture/vm-composition.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ Ghaf uses a three-layer composition pattern:
7373

7474
## How evalModules Works
7575

76-
The `lib.evalModules` function creates a lazily-evaluated module system:
76+
The `lib.nixosSystem` function creates a lazily-evaluated module system:
7777

7878
```nix
79-
lib.evalModules {
79+
lib.nixosSystem {
8080
# Values available to all modules without explicit passing
8181
specialArgs = {
8282
inherit lib inputs;
@@ -113,7 +113,7 @@ The `extendModules` function creates a **new** evaluated module set that include
113113

114114
```nix
115115
# Start with base
116-
baseConfig = lib.evalModules {
116+
baseConfig = lib.nixosSystem {
117117
specialArgs = { /* ... */ };
118118
modules = [ ./base.nix ];
119119
};
@@ -205,7 +205,7 @@ in
205205
guivmBase = lib.mkOption {
206206
type = lib.types.unspecified;
207207
readOnly = true;
208-
default = lib.evalModules {
208+
default = lib.nixosSystem {
209209
specialArgs = mkSpecialArgs "gui-vm";
210210
modules = [
211211
inputs.self.nixosModules.guivm-base
@@ -319,7 +319,7 @@ ghaf.virtualization.microvm = {
319319

320320
```nix
321321
# This works because evaluation is deferred
322-
guivmBase = lib.evalModules {
322+
guivmBase = lib.nixosSystem {
323323
specialArgs = {
324324
# References host config, but evaluated lazily
325325
globalConfig = config.ghaf.global-config;
@@ -345,7 +345,7 @@ upstreamGuivmBase # Still the same
345345

346346
```nix
347347
# Test VM config in isolation
348-
testConfig = lib.evalModules {
348+
testConfig = lib.nixosSystem {
349349
specialArgs = {
350350
globalConfig = lib.ghaf.profiles.debug;
351351
hostConfig = { vmName = "test-vm"; /* mock data */ };

docs/src/content/docs/ghaf/dev/guides/migration.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ microvm.vms.gui-vm.config = guivmBaseConfiguration // {
8484
}
8585
8686
# In profile (laptop-x86.nix)
87-
guivmBase = lib.evalModules {
87+
guivmBase = lib.nixosSystem {
8888
specialArgs = lib.ghaf.vm.mkSpecialArgs globalConfig hostConfigGuivm lib;
8989
modules = [ guivm-base hardwareExtras ];
9090
};
@@ -115,7 +115,7 @@ ghaf.virtualization.microvm.guivm.extraModules = lib.mkAfter [
115115
**Modern:**
116116
```nix
117117
# In profile - compose base with hardware modules
118-
guivmBase = lib.evalModules {
118+
guivmBase = lib.nixosSystem {
119119
specialArgs = ...;
120120
modules = [
121121
guivm-base
@@ -220,7 +220,7 @@ globalConfigOverrides = lib.ghaf.profiles.debug // {
220220
**Modern:**
221221
```nix
222222
# In evaluation (profile or target)
223-
lib.evalModules {
223+
lib.nixosSystem {
224224
specialArgs = { inherit inputs lib; };
225225
modules = [ ./module-a.nix ./module-b.nix ];
226226
}

docs/src/content/docs/ghaf/dev/library/profiles-api.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,24 @@ Factory function for creating custom profiles by extending a base profile.
154154
**Signature:**
155155

156156
```nix
157-
mkGlobalConfig :: AttrSet -> AttrSet
158-
mkGlobalConfig overrides
157+
mkGlobalConfig :: String -> AttrSet -> AttrSet
158+
mkGlobalConfig profileName overrides
159159
```
160160

161161
**Parameters:**
162162

163163
| Name | Type | Description |
164164
|------|------|-------------|
165-
| `overrides` | AttrSet | Values to merge over the debug profile base |
165+
| `profileName` | String | Base profile to extend: `"debug"`, `"release"`, or `"minimal"` |
166+
| `overrides` | AttrSet | Values to merge over the base profile |
166167

167168
**Returns:** Complete global configuration attrset.
168169

169170
**Example:**
170171

171172
```nix
172173
# Start with debug profile, customize some settings
173-
ghaf.global-config = lib.ghaf.mkGlobalConfig {
174+
ghaf.global-config = lib.ghaf.mkGlobalConfig "debug" {
174175
# Override specific settings
175176
givc.debug = false;
176177
development.ssh.daemon.enable = false;
@@ -215,7 +216,7 @@ ghaf.global-config = lib.ghaf.profiles.debug // {
215216
Use the factory for cleaner customization:
216217

217218
```nix
218-
ghaf.global-config = lib.ghaf.mkGlobalConfig {
219+
ghaf.global-config = lib.ghaf.mkGlobalConfig "debug" {
219220
# All debug profile defaults applied
220221
# Just specify overrides:
221222
features = {
@@ -233,13 +234,13 @@ Create a project-specific profile:
233234
# In downstream project's lib/profiles.nix
234235
{ lib }:
235236
{
236-
fmoDebug = lib.ghaf.mkGlobalConfig {
237+
fmoDebug = lib.ghaf.mkGlobalConfig "debug" {
237238
# FMO-specific debug settings
238239
features.yubikey.targetVms = [ "gui-vm" "gcs-vm" ];
239240
logging.listener.port = 10000;
240241
};
241242
242-
fmoRelease = lib.ghaf.profiles.release // {
243+
fmoRelease = lib.ghaf.mkGlobalConfig "release" {
243244
# FMO production overrides
244245
features.yubikey.targetVms = [ "gui-vm" "gcs-vm" ];
245246
};

0 commit comments

Comments
 (0)