Confused by disabling module example

I came across this example for disabling a module and I’m confused.

The way I read it, it will always be disabled when this configuration is included. So what does the enable flag do?

Shouldn’t this example only have the disabledModules attribute?

Usually the intent of disabling a NixOS module is to override it with a different implementation. That’s what the example is illustrating.

This example shows how to define a custom module as a replacement for an
existing module. Importing this module will disable the original module
without having to know it’s implementation details.

I’m not sure if overriding makes sense for that particular module since it’s no longer part of NixOS, thus I’m unfamiliar with its implementation. So, I understand the confusion.

Nevertheless, the point the author is making is that it’s possible to override an existing module implementation by first disabling it.

enable options are just a convention. You can write a module that always adds something to the configuration.

For example if you take a look at this, environment.etc."locale.conf".source is always set. If you wanted to, you could either override those options or use disabledModules. Although that might be a bad idea, because other modules might rely on this specific one.

Which is where what @emmanuelrosa said comes in again, this mechanism is mainly used to replace an existing module with a modified implementation.

Ah, I get it now. It disables the module, then it configures the enable option just in case someone is using it, and for the rest it just disables man pages.

I was confused by it creating options that weren’t used in the implementation.

Thanks @emmanuelrosa @ajs124