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,37 @@ 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+ default = true ;
260+ } ;
261+ targetVms = mkOption {
262+ type = types . listOf types . str ;
263+ default = [ ] ;
264+ description = "VMs where Ghaf power management should be enabled" ;
265+ } ;
266+ } ;
267+
268+ performance = {
269+ enable = mkEnableOption "Ghaf performance and PPD profiles" // {
270+ default = true ;
271+ } ;
272+ targetVms = mkOption {
273+ type = types . listOf types . str ;
274+ default = [ ] ;
275+ description = "VMs where Ghaf performance and PPD profiles should be enabled" ;
276+ } ;
277+ } ;
330278 } ;
331279 } ;
332280 } ;
@@ -396,11 +344,6 @@ rec {
396344 debug = false ;
397345 } ;
398346
399- services = {
400- power-manager . enable = false ;
401- performance . enable = false ;
402- } ;
403-
404347 storage = {
405348 encryption . enable = false ;
406349 storeOnDisk = false ;
@@ -437,6 +380,22 @@ rec {
437380 enable = true ;
438381 targetVms = [ "audio-vm" ] ;
439382 } ;
383+ power-manager = {
384+ enable = true ;
385+ targetVms = [
386+ "gui-vm"
387+ "audio-vm"
388+ "net-vm"
389+ ] ;
390+ } ;
391+ performance = {
392+ enable = true ;
393+ targetVms = [
394+ "gui-vm"
395+ "audio-vm"
396+ "net-vm"
397+ ] ;
398+ } ;
440399 } ;
441400 } ;
442401
@@ -458,11 +417,6 @@ rec {
458417 debug = false ;
459418 } ;
460419
461- services = {
462- power-manager . enable = true ;
463- performance . enable = true ;
464- } ;
465-
466420 storage = {
467421 encryption . enable = true ;
468422 storeOnDisk = false ;
@@ -499,6 +453,22 @@ rec {
499453 enable = true ;
500454 targetVms = [ "audio-vm" ] ;
501455 } ;
456+ power-manager = {
457+ enable = true ;
458+ targetVms = [
459+ "gui-vm"
460+ "audio-vm"
461+ "net-vm"
462+ ] ;
463+ } ;
464+ performance = {
465+ enable = true ;
466+ targetVms = [
467+ "gui-vm"
468+ "audio-vm"
469+ "net-vm"
470+ ] ;
471+ } ;
502472 } ;
503473 } ;
504474
@@ -520,11 +490,6 @@ rec {
520490 debug = false ;
521491 } ;
522492
523- services = {
524- power-manager . enable = false ;
525- performance . enable = false ;
526- } ;
527-
528493 storage = {
529494 encryption . enable = false ;
530495 storeOnDisk = false ;
@@ -559,6 +524,14 @@ rec {
559524 enable = false ;
560525 targetVms = [ ] ;
561526 } ;
527+ power-manager = {
528+ enable = false ;
529+ targetVms = [ ] ;
530+ } ;
531+ performance = {
532+ enable = false ;
533+ targetVms = [ ] ;
534+ } ;
562535 } ;
563536 } ;
564537 } ;
0 commit comments