This definition will cause Nix to fail with an “infinite recursion” error. Why? Because the value of <option>config.services.httpd.enable</option> depends on the value being constructed here. After all, you could also write the clearly circular and contradictory:
The special function <varname>mkIf</varname> causes the evaluation of the conditional to be “pushed down” into the individual definitions, as if you had written:
A module can override the definitions of an option in other modules by setting a <emphasis>priority</emphasis>. All option definitions that do not have the lowest priority value are discarded. By default, option definitions have priority 1000. You can specify an explicit priority by using <varname>mkOverride</varname>, e.g.
This definition causes all other definitions with priorities above 10 to be discarded. The function <varname>mkForce</varname> is equal to <varname>mkOverride 50</varname>.
In conjunction with <literal>mkIf</literal>, it is sometimes useful for a module to return multiple sets of option definitions, to be merged together as if they were declared in separate modules. This can be done using <varname>mkMerge</varname>: