2626# }
2727{ lib } :
2828let
29- inherit ( lib ) mkOption types ;
29+ inherit ( lib ) mkOption mkEnableOption types ;
3030in
3131rec {
3232 # Type definition for global config options
3333 # This is used in the ghaf.global-config option definition
3434 globalConfigType = types . submodule {
3535 options = {
3636 debug = {
37- enable = mkOption {
38- type = types . bool ;
39- default = false ;
40- description = "Enable debug mode globally (host and all VMs)" ;
41- } ;
37+ enable = mkEnableOption "debug mode globally (host and all VMs)" ;
4238 } ;
4339
4440 development = {
4541 ssh = {
4642 daemon = {
47- enable = mkOption {
48- type = types . bool ;
49- default = false ;
50- description = "Enable SSH daemon globally" ;
51- } ;
43+ enable = mkEnableOption "SSH daemon globally" ;
5244 } ;
5345 } ;
5446
5547 debug = {
5648 tools = {
57- enable = mkOption {
58- type = types . bool ;
59- default = false ;
60- description = "Enable debug tools globally" ;
61- } ;
49+ enable = mkEnableOption "debug tools globally" ;
6250 } ;
6351 } ;
6452
6553 nix-setup = {
66- enable = mkOption {
67- type = types . bool ;
68- default = false ;
69- description = "Enable Nix development setup globally" ;
70- } ;
54+ enable = mkEnableOption "Nix development setup globally" ;
7155 } ;
7256 } ;
7357
7458 logging = {
75- enable = mkOption {
76- type = types . bool ;
77- default = false ;
78- description = "Enable logging globally" ;
79- } ;
59+ enable = mkEnableOption "logging globally" ;
8060
8161 listener = {
8262 address = mkOption {
@@ -103,53 +83,23 @@ rec {
10383
10484 security = {
10585 audit = {
106- enable = mkOption {
107- type = types . bool ;
108- default = false ;
109- description = "Enable security auditing globally" ;
110- } ;
86+ enable = mkEnableOption "security auditing globally" ;
11187 } ;
11288 } ;
11389
11490 givc = {
115- enable = mkOption {
116- type = types . bool ;
117- default = false ;
118- description = "Enable GIVC (Ghaf Inter-VM Communication) globally" ;
119- } ;
91+ enable = mkEnableOption "GIVC (Ghaf Inter-VM Communication) globally" ;
12092
12193 debug = mkOption {
12294 type = types . bool ;
12395 default = false ;
124- description = "Enable GIVC debug mode" ;
125- } ;
126- } ;
127-
128- services = {
129- power-manager = {
130- enable = mkOption {
131- type = types . bool ;
132- default = false ;
133- description = "Enable power manager service globally" ;
134- } ;
135- } ;
136-
137- performance = {
138- enable = mkOption {
139- type = types . bool ;
140- default = false ;
141- description = "Enable performance service globally" ;
142- } ;
96+ description = "Whether to enable GIVC debug mode" ;
14397 } ;
14498 } ;
14599
146100 storage = {
147101 encryption = {
148- enable = mkOption {
149- type = types . bool ;
150- default = false ;
151- description = "Enable storage encryption globally" ;
152- } ;
102+ enable = mkEnableOption "storage encryption globally" ;
153103 } ;
154104
155105 storeOnDisk = mkOption {
@@ -161,11 +111,7 @@ rec {
161111
162112 # Shared memory configuration
163113 shm = {
164- enable = mkOption {
165- type = types . bool ;
166- default = false ;
167- description = "Enable shared memory for inter-VM communication" ;
168- } ;
114+ enable = mkEnableOption "shared memory for inter-VM communication" ;
169115
170116 serverSocketPath = mkOption {
171117 type = types . str ;
@@ -183,22 +129,14 @@ rec {
183129 # Graphics/boot UI settings
184130 graphics = {
185131 boot = {
186- enable = mkOption {
187- type = types . bool ;
188- default = false ;
189- description = "Enable graphical boot support (splash screen, user login detection)" ;
190- } ;
132+ enable = mkEnableOption "graphical boot support (splash screen, user login detection)" ;
191133 } ;
192134 } ;
193135
194136 # IDS VM specific settings
195137 idsvm = {
196138 mitmproxy = {
197- enable = mkOption {
198- type = types . bool ;
199- default = false ;
200- description = "Enable MITM proxy in IDS VM for traffic inspection" ;
201- } ;
139+ enable = mkEnableOption "MITM proxy in IDS VM for traffic inspection" ;
202140 } ;
203141 } ;
204142
@@ -241,10 +179,8 @@ rec {
241179 features = {
242180 # Hardware authentication services
243181 fprint = {
244- enable = mkOption {
245- type = types . bool ;
182+ enable = mkEnableOption "fingerprint authentication support" // {
246183 default = true ;
247- description = "Enable fingerprint authentication support" ;
248184 } ;
249185 targetVms = mkOption {
250186 type = types . listOf types . str ;
@@ -258,10 +194,8 @@ rec {
258194 } ;
259195
260196 yubikey = {
261- enable = mkOption {
262- type = types . bool ;
197+ enable = mkEnableOption "Yubikey 2FA support" // {
263198 default = true ;
264- description = "Enable Yubikey 2FA support" ;
265199 } ;
266200 targetVms = mkOption {
267201 type = types . listOf types . str ;
@@ -275,10 +209,8 @@ rec {
275209 } ;
276210
277211 brightness = {
278- enable = mkOption {
279- type = types . bool ;
212+ enable = mkEnableOption "brightness control via VirtIO" // {
280213 default = true ;
281- description = "Enable brightness control via VirtIO" ;
282214 } ;
283215 targetVms = mkOption {
284216 type = types . listOf types . str ;
@@ -289,10 +221,8 @@ rec {
289221
290222 # Networking services
291223 wifi = {
292- enable = mkOption {
293- type = types . bool ;
224+ enable = mkEnableOption "WiFi networking support" // {
294225 default = true ;
295- description = "Enable WiFi networking support" ;
296226 } ;
297227 targetVms = mkOption {
298228 type = types . listOf types . str ;
@@ -303,10 +233,8 @@ rec {
303233
304234 # Audio services
305235 audio = {
306- enable = mkOption {
307- type = types . bool ;
236+ enable = mkEnableOption "audio services" // {
308237 default = true ;
309- description = "Enable audio services" ;
310238 } ;
311239 targetVms = mkOption {
312240 type = types . listOf types . str ;
@@ -316,17 +244,33 @@ rec {
316244 } ;
317245
318246 bluetooth = {
319- enable = mkOption {
320- type = types . bool ;
247+ enable = mkEnableOption "Bluetooth support" // {
321248 default = true ;
322- description = "Enable Bluetooth support" ;
323249 } ;
324250 targetVms = mkOption {
325251 type = types . listOf types . str ;
326252 default = [ "audio-vm" ] ;
327253 description = "VMs that should have Bluetooth support" ;
328254 } ;
329255 } ;
256+
257+ power-manager = {
258+ enable = mkEnableOption "Ghaf power management" ;
259+ targetVms = mkOption {
260+ type = types . listOf types . str ;
261+ default = [ ] ;
262+ description = "VMs where Ghaf power management should be enabled" ;
263+ } ;
264+ } ;
265+
266+ performance = {
267+ enable = mkEnableOption "Ghaf performance and PPD profiles" ;
268+ targetVms = mkOption {
269+ type = types . listOf types . str ;
270+ default = [ ] ;
271+ description = "VMs where Ghaf performance and PPD profiles should be enabled" ;
272+ } ;
273+ } ;
330274 } ;
331275 } ;
332276 } ;
@@ -396,11 +340,6 @@ rec {
396340 debug = false ;
397341 } ;
398342
399- services = {
400- power-manager . enable = false ;
401- performance . enable = false ;
402- } ;
403-
404343 storage = {
405344 encryption . enable = false ;
406345 storeOnDisk = false ;
@@ -437,6 +376,22 @@ rec {
437376 enable = true ;
438377 targetVms = [ "audio-vm" ] ;
439378 } ;
379+ power-manager = {
380+ enable = true ;
381+ targetVms = [
382+ "gui-vm"
383+ "audio-vm"
384+ "net-vm"
385+ ] ;
386+ } ;
387+ performance = {
388+ enable = true ;
389+ targetVms = [
390+ "gui-vm"
391+ "audio-vm"
392+ "net-vm"
393+ ] ;
394+ } ;
440395 } ;
441396 } ;
442397
@@ -458,11 +413,6 @@ rec {
458413 debug = false ;
459414 } ;
460415
461- services = {
462- power-manager . enable = true ;
463- performance . enable = true ;
464- } ;
465-
466416 storage = {
467417 encryption . enable = true ;
468418 storeOnDisk = false ;
@@ -499,6 +449,22 @@ rec {
499449 enable = true ;
500450 targetVms = [ "audio-vm" ] ;
501451 } ;
452+ power-manager = {
453+ enable = true ;
454+ targetVms = [
455+ "gui-vm"
456+ "audio-vm"
457+ "net-vm"
458+ ] ;
459+ } ;
460+ performance = {
461+ enable = true ;
462+ targetVms = [
463+ "gui-vm"
464+ "audio-vm"
465+ "net-vm"
466+ ] ;
467+ } ;
502468 } ;
503469 } ;
504470
@@ -520,11 +486,6 @@ rec {
520486 debug = false ;
521487 } ;
522488
523- services = {
524- power-manager . enable = false ;
525- performance . enable = false ;
526- } ;
527-
528489 storage = {
529490 encryption . enable = false ;
530491 storeOnDisk = false ;
@@ -559,6 +520,14 @@ rec {
559520 enable = false ;
560521 targetVms = [ ] ;
561522 } ;
523+ power-manager = {
524+ enable = false ;
525+ targetVms = [ ] ;
526+ } ;
527+ performance = {
528+ enable = false ;
529+ targetVms = [ ] ;
530+ } ;
562531 } ;
563532 } ;
564533 } ;
0 commit comments