Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/src/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ A general format for modules is shown below.
}
```

> [!CAUTION]
Comment thread
trueNAHO marked this conversation as resolved.
> You **must** check _both_ `config.stylix.enable` _and_ your target's own
> `enable` option before defining any config.
>
> In the above example this is done using
> `config = lib.mkIf (config.stylix.enable && config.stylix.targets.«name».enable)`.

The human readable name will be inserted into the following sentence:

> Whether to enable theming for «human readable name».
Expand Down
2 changes: 1 addition & 1 deletion modules/gtk/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ in
flatpakSupport.enable = config.lib.stylix.mkEnableTarget "support for theming Flatpak apps" true;
};

config = lib.mkIf cfg.enable (
config = lib.mkIf (config.stylix.enable && cfg.enable) (
lib.mkMerge [
{
warnings =
Expand Down
2 changes: 1 addition & 1 deletion modules/kitty/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ in
};
};

config = lib.mkIf cfg.enable {
config = lib.mkIf (config.stylix.enable && cfg.enable) {
programs.kitty = {
font = {
inherit (config.stylix.fonts.monospace) package name;
Expand Down
5 changes: 4 additions & 1 deletion modules/kubecolor/hm.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{ config, lib, ... }:
let
cfg = config.stylix.targets.kubecolor;
in
{
options.stylix.targets.kubecolor.enable =
config.lib.stylix.mkEnableTarget "kubecolor" true;

config = lib.mkIf config.stylix.targets.kubecolor.enable {
config = lib.mkIf (config.stylix.enable && cfg.enable) {
programs.kubecolor.settings = {
preset =
if config.stylix.polarity == "either" then "" else "${config.stylix.polarity}";
Expand Down
2 changes: 1 addition & 1 deletion stylix/target.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down