Note: I haven’t tested this yet, but I don’t see any reason why it wouldn’t.
You can have the best of both worlds by importing modules and then enabling/disabling them with config options.
The idea is that every single module, whether you want to be able to toggle them on/off or not, gets imported into your configuration.nix. For options that you want to permanently be enabled, there is no more work to do. For options or groups of options that you want to be toggleable on/off, you put them behind a lib.mkIf.
In the following video, Vimjoyer essentially makes an option that enables/disables an entire module, even though it is already imported. He creates an options.module1.enable option, and then hides the entire contents of module1 behind a lib.mkIf options.module1.enable
Note: I haven’t tested this yet, but I don’t see any reason why it wouldn’t.
You can have the best of both worlds by importing modules and then enabling/disabling them with config options.
The idea is that every single module, whether you want to be able to toggle them on/off or not, gets imported into your configuration.nix. For options that you want to permanently be enabled, there is no more work to do. For options or groups of options that you want to be toggleable on/off, you put them behind a
lib.mkIf
.In the following video, Vimjoyer essentially makes an option that enables/disables an entire module, even though it is already imported. He creates an
options.module1.enable
option, and then hides the entire contents of module1 behind alib.mkIf options.module1.enable
https://youtu.be/vYc6IzKvAJQ?t=147