stylix: add overlay module (#1048)

Closes: https://github.com/danth/stylix/issues/865
Link: https://github.com/danth/stylix/pull/1048

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
awwpotato 2025-03-31 10:36:36 -07:00 committed by GitHub
parent c546582bae
commit eb19696b18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 143 additions and 74 deletions

View file

@ -73,6 +73,34 @@ one of the following applies:
- There is no reliable way to detect whether the target is installed, *and*
enabling it unconditionally would cause problems.
### Overlays
If your module is provided as an overlay it uses a special format, where config
is transparently passed to the platform (e.g. nixos) and overlay is a function
taking two arguments and returning an attrset:
```nix
{
lib,
config,
...
}:
{
options.stylix.targets.«name».enable =
config.lib.stylix.mkEnableOverlay "«human readable name»";
overlay =
final: prev:
lib.optionalAttrs
(config.stylix.enable && config.stylix.targets.«name».enable)
{
«name» = prev.«name».overrideAttrs (oldAttrs: {
});
};
}
```
## How to apply colors
Refer to the [style guide](./styling.md) to see how colors are named,