Conditional module imports

Yes agreed - I eventually realised that it’s less confusing to import all modules then use options to toggle them.

I like this terminology - thanks for defining it. I found some more info about it in the Puppet 8 Docs and Puppet Enterprise Guide. What’s called a “component module” in Puppet would correspond to an attrset of options like networking.firewall or services.apache, right?

In one Puppet doc, it states that a profile can include other profiles. In the other, the diagram implies that only a role can include profiles. I prefer the arrangement where profiles can include other profiles.


I guess what I was meaning to ask is whether there is an easier way of declaring NixOS options for each profile.

In my config, I have at least 150 .nix files which are profiles. So it’s a lot of error-prone work to surround each one with an option like this:

{ lib, config, pkgs, ... }: {
  options.me.profiles.this = lib.mkEnableOption "install and configure this";
  config = lib.mkIf config.me.profiles.this {
    # ... profile config here ...
   };
}