stylix: remove cfg.enable from mkEnableTarget default

The global `stylix.enable` option is not relevant to the per-target
`enable` option's default.

The individual modules should already be gated behind `stylix.enable`,
so there is no need for it to also affect the value of
`stylix.targets.«name».enable`.

This should not produce any change in behavior for correctly written
modules.

---

To give a concrete example:

```nix
{
  stylix.enable = false;
  stylix.autoEnable = true;
  stylix.targets.foo.enable = true;
}
```

Here, the `stylix.enable` option is set to `false`, so no targets should
be enabled, regardless of their per-target `enable` option's value.

However if the `foo` target assumes it only needs to read its own
`enable` option, in this example it would define its config even though
Stylix is disabled globally.
This commit is contained in:
Daniel Thwaites 2024-06-10 20:33:08 +01:00 committed by Matt Sturgeon
parent b460904a6f
commit 030af3e071
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -40,7 +40,7 @@
humanName: autoEnable:
lib.mkEnableOption "theming for ${humanName}"
// {
default = cfg.enable && cfg.autoEnable && autoEnable;
default = cfg.autoEnable && autoEnable;
example = !autoEnable;
}
// lib.optionalAttrs autoEnable {