From a4ffbc20eabd1dd14ae43298ec58dd1c4bf1e874 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:05:21 +0100 Subject: [PATCH 01/10] modules: flatten single-attribute set declarations --- modules/cava/hm.nix | 4 +--- modules/hyprlock/hm.nix | 4 +--- modules/lightdm/nixos.nix | 4 +--- modules/yazi/hm.nix | 10 ++++------ 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/modules/cava/hm.nix b/modules/cava/hm.nix index 1ba12135..a0b1bc21 100644 --- a/modules/cava/hm.nix +++ b/modules/cava/hm.nix @@ -3,9 +3,7 @@ mkTarget { name = "cava"; humanName = "CAVA"; - extraOptions = { - rainbow.enable = lib.mkEnableOption "rainbow gradient theming"; - }; + extraOptions.rainbow.enable = lib.mkEnableOption "rainbow gradient theming"; configElements = { cfg, colors }: diff --git a/modules/hyprlock/hm.nix b/modules/hyprlock/hm.nix index bf2d8ee2..6e644633 100644 --- a/modules/hyprlock/hm.nix +++ b/modules/hyprlock/hm.nix @@ -8,9 +8,7 @@ mkTarget { name = "hyprlock"; humanName = "Hyprlock"; - extraOptions = { - useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprlock" true; - }; + extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprlock" true; configElements = [ ( diff --git a/modules/lightdm/nixos.nix b/modules/lightdm/nixos.nix index 405cfbac..c7fa38ed 100644 --- a/modules/lightdm/nixos.nix +++ b/modules/lightdm/nixos.nix @@ -8,9 +8,7 @@ mkTarget { name = "lightdm"; humanName = "LightDM"; - extraOptions = { - useWallpaper = config.lib.stylix.mkEnableWallpaper "LightDM" true; - }; + extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "LightDM" true; configElements = { cfg, image }: diff --git a/modules/yazi/hm.nix b/modules/yazi/hm.nix index bf01e02e..397f8874 100644 --- a/modules/yazi/hm.nix +++ b/modules/yazi/hm.nix @@ -4,12 +4,10 @@ mkTarget { name = "yazi"; humanName = "Yazi"; - extraOptions = { - boldDirectory = lib.mkOption { - description = "Whether to use bold font for directories."; - type = lib.types.bool; - default = true; - }; + extraOptions.boldDirectory = lib.mkOption { + description = "Whether to use bold font for directories."; + type = lib.types.bool; + default = true; }; configElements = From 25354cc88b67bede74dbf314949821889ae15e48 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:28:32 +0200 Subject: [PATCH 02/10] stylix/mk-target: sort optional arguments --- stylix/mk-target.nix | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index 49f95ca4..32a13df6 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -82,21 +82,6 @@ The default (`true`) is inherited from `mkEnableTargetWith`. - `enableExample` (Boolean or literal expression) - : An example to include on the enable option. The default is calculated - automatically by `mkEnableTargetWith` and depends on `autoEnable` and - whether an `autoEnableExpr` is used. - - `extraOptions` (Attribute set) - : Additional options to be added in the `stylix.targets.${name}` namespace - along the `stylix.targets.${name}.enable` option. - - For example, an extension guard used in the configuration can be declared - as follows: - ```nix - { extension.enable = lib.mkEnableOption "the bloated dependency"; } - ``` - `configElements` (List or attribute set or function or path) : Configuration functions that are automatically safeguarded when any of their arguments is disabled. The provided `cfg` argument conveniently @@ -125,6 +110,21 @@ ) ``` + `enableExample` (Boolean or literal expression) + : An example to include on the enable option. The default is calculated + automatically by `mkEnableTargetWith` and depends on `autoEnable` and + whether an `autoEnableExpr` is used. + + `extraOptions` (Attribute set) + : Additional options to be added in the `stylix.targets.${name}` namespace + along the `stylix.targets.${name}.enable` option. + + For example, an extension guard used in the configuration can be declared + as follows: + ```nix + { extension.enable = lib.mkEnableOption "the bloated dependency"; } + ``` + `generalConfig` (Attribute set or function or path) : This argument mirrors the `configElements` argument but intentionally lacks automatic safeguarding and should only be used for complex @@ -176,9 +176,9 @@ autoEnable ? null, autoEnableExpr ? null, autoWrapEnableExpr ? null, + configElements ? [ ], enableExample ? null, extraOptions ? { }, - configElements ? [ ], generalConfig ? null, imports ? [ ], }@args: From 9afd8230cd8c92c0450f9f9ece65c05062160fc1 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:28:33 +0200 Subject: [PATCH 03/10] stylix/mk-target: document imports argument Fixes: 093087e969e2 ("stylix: add imports to mkTarget (#1363)") --- stylix/mk-target.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index 32a13df6..94658d8c 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -130,6 +130,9 @@ lacks automatic safeguarding and should only be used for complex configurations where `configElements` is unsuitable. +   `imports` (List) +   : The `imports` option forwarded to the Nixpkgs module system. + # Environment The function is provided alongside module arguments in any modules imported From 1272e6858e29205b8b03e696f121e6eedcb8b3b5 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:12:08 +0100 Subject: [PATCH 04/10] stylix/mk-target: rename mkConfig function to callModule Rename the mkConfig function to callModule to generalize the name beyond the specific config and options module arguments. Fixes: dea0337e0bff ("stylix: restrict access to config while using mkTarget (#1368)") --- stylix/mk-target.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index 94658d8c..1a032298 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -217,7 +217,7 @@ let ); # Call the configuration function with its required Stylix arguments. - mkConfig = fn: fn (getStylixAttrs fn); + callModule = fn: fn (getStylixAttrs fn); # Safeguard configuration functions when any of their arguments is # disabled. @@ -232,13 +232,13 @@ let (builtins.all (attr: attr.enable or (attr != null))) ]; in - lib.mkIf allAttrsEnabled (mkConfig c) + lib.mkIf allAttrsEnabled (callModule c) else c; in { imports = imports ++ [ - { options.stylix.targets.${name} = mkConfig (lib.toFunction extraOptions); } + { options.stylix.targets.${name} = callModule (lib.toFunction extraOptions); } ]; options.stylix.targets.${name}.enable = @@ -258,7 +258,7 @@ let config = lib.mkIf (config.stylix.enable && cfg.enable) ( lib.mkMerge ( lib.optional (generalConfig != null) ( - mkConfig ( + callModule ( if builtins.isPath generalConfig then import generalConfig else generalConfig ) ) From f7b554dea904393e483df9c13f0b6d6286d53ba7 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:28:34 +0200 Subject: [PATCH 05/10] stylix/mk-target: polish implementation and improve error reporting Polish the mkTarget implementation to improve error reporting and simplify future enhancements. Configuration elements can now recursively resolve to paths. --- stylix/mk-target.nix | 106 +++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 50 deletions(-) diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index 1a032298..21cf51ce 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -182,63 +182,75 @@ configElements ? [ ], enableExample ? null, extraOptions ? { }, - generalConfig ? null, + generalConfig ? { }, imports ? [ ], }@args: let module = { config, lib, ... }: let - cfg = config.stylix.targets.${name}; + callModule = + let + areArgumentsEnabled = lib.flip lib.pipe [ + builtins.attrValues + (builtins.all (argument: argument.enable or (argument != null))) + ]; - # Get the list of function de-structured argument names. - functionArgNames = - fn: - lib.pipe fn [ - lib.functionArgs - builtins.attrNames - ]; + getArguments = + function: + lib.genAttrs + (lib.pipe function [ + lib.functionArgs + builtins.attrNames + ]) + ( + argument: + if argument == "cfg" then + cfg - getStylixAttrs = - fn: - lib.genAttrs (functionArgNames fn) ( - arg: - if arg == "cfg" then - cfg - else if arg == "colors" then - config.lib.stylix.colors + else if argument == "colors" then + config.lib.stylix.colors + + else + config.stylix.${argument} or (throw "stylix: mkTarget expected one of ${ + lib.concatMapStringsSep ", " (expected: "`${expected}`") ( + lib.naturalSort ( + [ + "cfg" + "colors" + ] + ++ builtins.attrNames config.stylix + ) + ) + }, but got: ${argument}") + ); + in + safeguard: config': + let + arguments = getArguments config'; + in + if builtins.isFunction config' then + if safeguard then + lib.mkIf (areArgumentsEnabled arguments) (config' arguments) else - config.stylix.${arg} - or (throw "stylix: mkTarget expected one of `cfg`, `colors`, ${ - lib.concatMapStringsSep ", " (name: "`${name}`") ( - builtins.attrNames config.stylix - ) - }, but got: ${arg}") - ); + config' arguments - # Call the configuration function with its required Stylix arguments. - callModule = fn: fn (getStylixAttrs fn); + else if builtins.isAttrs config' then + config' + + else if builtins.isPath config' then + callModule safeguard (import config') - # Safeguard configuration functions when any of their arguments is - # disabled. - mkConditionalConfig = - c: - if builtins.isFunction c then - let - allAttrsEnabled = lib.pipe c [ - getStylixAttrs - builtins.attrValues - # If the attr has no enable option, it is instead disabled when null - (builtins.all (attr: attr.enable or (attr != null))) - ]; - in - lib.mkIf allAttrsEnabled (callModule c) else - c; + throw "stylix: mkTarget expected a configuration to be a function, an attribute set, or a path, but got ${builtins.typeOf config'}: ${ + lib.generators.toPretty { } config' + }"; + + cfg = config.stylix.targets.${name}; in { imports = imports ++ [ - { options.stylix.targets.${name} = callModule (lib.toFunction extraOptions); } + { options.stylix.targets.${name} = callModule false extraOptions; } ]; options.stylix.targets.${name}.enable = @@ -257,14 +269,8 @@ let config = lib.mkIf (config.stylix.enable && cfg.enable) ( lib.mkMerge ( - lib.optional (generalConfig != null) ( - callModule ( - if builtins.isPath generalConfig then import generalConfig else generalConfig - ) - ) - ++ map (c: mkConditionalConfig (if builtins.isPath c then import c else c)) ( - lib.toList configElements - ) + lib.singleton (callModule false generalConfig) + ++ map (callModule true) (lib.toList configElements) ) ); }; From 76d05fd9c068d63f0dd747d40bcb8a4a57720daa Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:28:34 +0200 Subject: [PATCH 06/10] stylix/mk-target: rename generalConfig argument to unconditionalConfig Rename the generalConfig argument to unconditionalConfig to better imply the intentional lack of safeguarding. --- stylix/mk-target.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index 21cf51ce..aa3a1b68 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -22,7 +22,7 @@ name = "«name»"; humanName = "«human readable name»"; - generalConfig = + unconditionalConfig = lib.mkIf complexCondition { home.packages = [ pkgs.hello ]; }; @@ -125,14 +125,14 @@ { extension.enable = lib.mkEnableOption "the bloated dependency"; } ``` - `generalConfig` (Attribute set or function or path) +   `imports` (List) +   : The `imports` option forwarded to the Nixpkgs module system. + + `unconditionalConfig` (Attribute set or function or path) : This argument mirrors the `configElements` argument but intentionally lacks automatic safeguarding and should only be used for complex configurations where `configElements` is unsuitable. -   `imports` (List) -   : The `imports` option forwarded to the Nixpkgs module system. - # Environment The function is provided alongside module arguments in any modules imported @@ -149,7 +149,7 @@ # name = "example"; # humanName = "Example Target"; # -# generalConfig = +# unconditionalConfig = # { lib, pkgs }: # lib.mkIf complexCondition { # home.packages = [ pkgs.hello ]; @@ -182,8 +182,8 @@ configElements ? [ ], enableExample ? null, extraOptions ? { }, - generalConfig ? { }, imports ? [ ], + unconditionalConfig ? { }, }@args: let module = @@ -269,7 +269,7 @@ let config = lib.mkIf (config.stylix.enable && cfg.enable) ( lib.mkMerge ( - lib.singleton (callModule false generalConfig) + lib.singleton (callModule false unconditionalConfig) ++ map (callModule true) (lib.toList configElements) ) ); From 16df6b8448a856532b66ef8f7e012d29390d070b Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:28:35 +0200 Subject: [PATCH 07/10] treewide: rename mkTarget's configElements and extraOptions options Rename mkTarget's 'configElements' argument to 'config' and 'extraOptions' to 'options' to provide a more transparent interface with the underlying Nixpkgs module system. --- doc/src/modules.md | 2 +- modules/alacritty/hm.nix | 2 +- modules/anki/hm.nix | 2 +- modules/ashell/hm.nix | 2 +- modules/avizo/hm.nix | 2 +- modules/bat/hm.nix | 2 +- modules/bemenu/hm.nix | 4 ++-- modules/blender/hm.nix | 4 ++-- modules/bspwm/hm.nix | 2 +- modules/btop/hm.nix | 2 +- modules/cava/hm.nix | 4 ++-- modules/cavalier/hm.nix | 2 +- modules/chromium/nixos.nix | 2 +- modules/console/droid.nix | 2 +- modules/console/nixos.nix | 2 +- modules/discord/nixcord.nix | 4 ++-- modules/discord/vencord.nix | 4 ++-- modules/discord/vesktop.nix | 4 ++-- modules/dunst/hm.nix | 2 +- modules/emacs/hm.nix | 2 +- modules/eog/hm.nix | 2 +- modules/fcitx5/hm.nix | 2 +- modules/feh/hm.nix | 2 +- modules/feh/nixos.nix | 2 +- modules/firefox/each-config.nix | 4 ++-- modules/fish/hm.nix | 2 +- modules/fish/nixos.nix | 2 +- modules/fnott/hm.nix | 2 +- modules/foliate/hm.nix | 2 +- modules/font-packages/darwin.nix | 2 +- modules/font-packages/hm.nix | 2 +- modules/font-packages/nixos.nix | 2 +- modules/fontconfig/fontconfig.nix | 2 +- modules/foot/hm.nix | 2 +- modules/forge/hm.nix | 2 +- modules/fuzzel/hm.nix | 2 +- modules/fzf/hm.nix | 2 +- modules/gdu/hm.nix | 2 +- modules/gedit/hm.nix | 2 +- modules/ghostty/hm.nix | 2 +- modules/gitui/hm.nix | 2 +- modules/glance/hm.nix | 2 +- modules/glance/nixos.nix | 2 +- modules/gnome-text-editor/hm.nix | 2 +- modules/gnome/hm.nix | 4 ++-- modules/gtk/hm.nix | 4 ++-- modules/gtk/nixos.nix | 2 +- modules/gtksourceview/hm.nix | 2 +- modules/halloy/hm.nix | 2 +- modules/helix/hm.nix | 4 ++-- modules/hyprland/hm.nix | 4 ++-- modules/hyprlock/hm.nix | 4 ++-- modules/hyprpanel/hm.nix | 2 +- modules/hyprpaper/hm.nix | 2 +- modules/i3/hm.nix | 4 ++-- modules/i3bar-river/hm.nix | 2 +- modules/jankyborders/darwin.nix | 2 +- modules/k9s/hm.nix | 2 +- modules/kitty/hm.nix | 4 ++-- modules/kmscon/nixos.nix | 2 +- modules/kubecolor/hm.nix | 2 +- modules/lazygit/hm.nix | 2 +- modules/lightdm/nixos.nix | 4 ++-- modules/limine/nixos.nix | 4 ++-- modules/mako/hm.nix | 2 +- modules/mangohud/hm.nix | 2 +- modules/micro/hm.nix | 2 +- modules/mpv/hm.nix | 2 +- modules/ncspot/hm.nix | 4 ++-- modules/neovim/neovide.nix | 2 +- modules/neovim/neovim.nix | 4 ++-- modules/neovim/nixvim.nix | 4 ++-- modules/neovim/nvf.nix | 4 ++-- modules/neovim/vim.nix | 2 +- modules/nushell/hm.nix | 2 +- modules/obsidian/hm.nix | 4 ++-- modules/opencode/hm.nix | 2 +- modules/plymouth/nixos.nix | 4 ++-- modules/qutebrowser/hm.nix | 2 +- modules/regreet/nixos.nix | 4 ++-- modules/rio/hm.nix | 2 +- modules/rofi/hm.nix | 2 +- modules/spicetify/spicetify.nix | 2 +- modules/spotify-player/hm.nix | 2 +- modules/starship/hm.nix | 2 +- modules/swaylock/hm.nix | 4 ++-- modules/swaync/hm.nix | 2 +- modules/sxiv/hm.nix | 2 +- modules/tmux/hm.nix | 2 +- modules/tofi/hm.nix | 2 +- modules/vicinae/hm.nix | 2 +- modules/vivid/hm.nix | 2 +- modules/vscode/hm.nix | 4 ++-- modules/waybar/hm.nix | 4 ++-- modules/wayfire/hm.nix | 4 ++-- modules/wayprompt/hm.nix | 2 +- modules/wezterm/hm.nix | 4 ++-- modules/wob/hm.nix | 2 +- modules/wofi/hm.nix | 2 +- modules/wpaperd/hm.nix | 2 +- modules/xfce/hm.nix | 2 +- modules/xresources/hm.nix | 2 +- modules/yazi/hm.nix | 4 ++-- modules/zathura/hm.nix | 2 +- modules/zed/hm.nix | 2 +- modules/zellij/hm.nix | 2 +- modules/zen-browser/hm.nix | 4 ++-- stylix/mk-target.nix | 30 ++++++++++++++++-------------- 108 files changed, 153 insertions(+), 151 deletions(-) diff --git a/doc/src/modules.md b/doc/src/modules.md index 615f268e..75e91cdb 100644 --- a/doc/src/modules.md +++ b/doc/src/modules.md @@ -52,7 +52,7 @@ mkTarget { name = "«name»"; humanName = "«human readable name»"; - configElements = + config = { colors }: { programs.«name».theme.background = colors.base00; diff --git a/modules/alacritty/hm.nix b/modules/alacritty/hm.nix index ed54e3bb..f2fba176 100644 --- a/modules/alacritty/hm.nix +++ b/modules/alacritty/hm.nix @@ -5,7 +5,7 @@ mkTarget { name = "alacritty"; humanName = "Alacritty"; - configElements = [ + config = [ ( { colors }: { diff --git a/modules/anki/hm.nix b/modules/anki/hm.nix index 9f3c3808..6c70413d 100644 --- a/modules/anki/hm.nix +++ b/modules/anki/hm.nix @@ -8,7 +8,7 @@ mkTarget { name = "anki"; humanName = "Anki"; - configElements = + config = { colors }: { programs.anki.addons = lib.singleton ( diff --git a/modules/ashell/hm.nix b/modules/ashell/hm.nix index 41616ac8..76830f91 100644 --- a/modules/ashell/hm.nix +++ b/modules/ashell/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "ashell"; humanName = "Ashell"; - configElements = [ + config = [ ( { colors }: { diff --git a/modules/avizo/hm.nix b/modules/avizo/hm.nix index 25900638..21de0fa2 100644 --- a/modules/avizo/hm.nix +++ b/modules/avizo/hm.nix @@ -4,7 +4,7 @@ mkTarget { humanName = "Avizo"; # Referenced https://github.com/stacyharper/base16-mako - configElements = + config = { colors, opacity }: { services.avizo = { diff --git a/modules/bat/hm.nix b/modules/bat/hm.nix index ff424fca..48ab60c7 100644 --- a/modules/bat/hm.nix +++ b/modules/bat/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "bat"; humanName = "Bat"; - configElements = + config = { colors }: { programs.bat = { diff --git a/modules/bemenu/hm.nix b/modules/bemenu/hm.nix index ca0d5a6a..0438ea75 100644 --- a/modules/bemenu/hm.nix +++ b/modules/bemenu/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "bemenu"; humanName = "bemenu"; - extraOptions = + options = { fonts }: { fontSize = lib.mkOption { @@ -24,7 +24,7 @@ mkTarget { }; }; - configElements = [ + config = [ ( { cfg, fonts }: { diff --git a/modules/blender/hm.nix b/modules/blender/hm.nix index e4484063..b042fe38 100644 --- a/modules/blender/hm.nix +++ b/modules/blender/hm.nix @@ -3,13 +3,13 @@ mkTarget { name = "blender"; humanName = "Blender"; - extraOptions.themeBody = lib.mkOption { + options.themeBody = lib.mkOption { type = lib.types.lines; default = ""; internal = true; }; - configElements = [ + config = [ ./color-theme.nix ./font-theme.nix ( diff --git a/modules/bspwm/hm.nix b/modules/bspwm/hm.nix index fb51e970..b30bcd86 100644 --- a/modules/bspwm/hm.nix +++ b/modules/bspwm/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "bspwm"; humanName = "bspwm"; - configElements = + config = { colors }: { xsession.windowManager.bspwm.settings = with colors.withHashtag; { diff --git a/modules/btop/hm.nix b/modules/btop/hm.nix index c7de0798..eb46381b 100644 --- a/modules/btop/hm.nix +++ b/modules/btop/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "btop"; humanName = "btop"; - configElements = [ + config = [ ( { opacity }: { diff --git a/modules/cava/hm.nix b/modules/cava/hm.nix index a0b1bc21..5fbfb08a 100644 --- a/modules/cava/hm.nix +++ b/modules/cava/hm.nix @@ -3,9 +3,9 @@ mkTarget { name = "cava"; humanName = "CAVA"; - extraOptions.rainbow.enable = lib.mkEnableOption "rainbow gradient theming"; + options.rainbow.enable = lib.mkEnableOption "rainbow gradient theming"; - configElements = + config = { cfg, colors }: let mkGradient = diff --git a/modules/cavalier/hm.nix b/modules/cavalier/hm.nix index e5979cc7..b922e71a 100644 --- a/modules/cavalier/hm.nix +++ b/modules/cavalier/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "cavalier"; humanName = "Cavalier"; - configElements = + config = { colors }: { programs.cavalier.settings.general = { diff --git a/modules/chromium/nixos.nix b/modules/chromium/nixos.nix index d0d2201b..4154809c 100644 --- a/modules/chromium/nixos.nix +++ b/modules/chromium/nixos.nix @@ -3,7 +3,7 @@ mkTarget { name = "chromium"; humanName = "Chromium, Google Chrome and Brave"; - configElements = + config = { colors }: { programs.chromium = { diff --git a/modules/console/droid.nix b/modules/console/droid.nix index caf1f42d..bb7fc37a 100644 --- a/modules/console/droid.nix +++ b/modules/console/droid.nix @@ -3,7 +3,7 @@ mkTarget { name = "console"; humanName = "the Nix-on-Droid console"; - configElements = + config = { colors }: { terminal.colors = with colors.withHashtag; rec { diff --git a/modules/console/nixos.nix b/modules/console/nixos.nix index e63ab5f8..9c1230e0 100644 --- a/modules/console/nixos.nix +++ b/modules/console/nixos.nix @@ -3,7 +3,7 @@ mkTarget { name = "console"; humanName = "the Linux kernel console"; - configElements = + config = { colors }: { console.colors = with colors; [ diff --git a/modules/discord/nixcord.nix b/modules/discord/nixcord.nix index d974f9b7..af86da35 100644 --- a/modules/discord/nixcord.nix +++ b/modules/discord/nixcord.nix @@ -10,7 +10,7 @@ mkTarget { name = "nixcord"; humanName = "Nixcord"; - extraOptions = { + options = { themeBody = lib.mkOption { type = lib.types.lines; default = ""; @@ -23,7 +23,7 @@ mkTarget { }; }; - configElements = (import ./common/theme-elements.nix "nixcord") ++ [ + config = (import ./common/theme-elements.nix "nixcord") ++ [ ( { cfg }: let diff --git a/modules/discord/vencord.nix b/modules/discord/vencord.nix index 623006f0..f7647412 100644 --- a/modules/discord/vencord.nix +++ b/modules/discord/vencord.nix @@ -4,7 +4,7 @@ mkTarget { name = "vencord"; humanName = "Vencord"; - extraOptions = { + options = { themeBody = lib.mkOption { type = lib.types.lines; default = ""; @@ -17,7 +17,7 @@ mkTarget { }; }; - configElements = (import ./common/theme-elements.nix "vencord") ++ [ + config = (import ./common/theme-elements.nix "vencord") ++ [ ( { cfg }: lib.mkIf diff --git a/modules/discord/vesktop.nix b/modules/discord/vesktop.nix index afd98c8d..24103a48 100644 --- a/modules/discord/vesktop.nix +++ b/modules/discord/vesktop.nix @@ -4,13 +4,13 @@ mkTarget { name = "vesktop"; humanName = "Vesktop"; - extraOptions.themeBody = lib.mkOption { + options.themeBody = lib.mkOption { type = lib.types.lines; default = ""; internal = true; }; - configElements = (import ./common/theme-elements.nix "vesktop") ++ [ + config = (import ./common/theme-elements.nix "vesktop") ++ [ ( { cfg }: lib.mkIf (cfg.themeBody != (import ./common/theme-header.nix)) { diff --git a/modules/dunst/hm.nix b/modules/dunst/hm.nix index 9614aca2..61911221 100644 --- a/modules/dunst/hm.nix +++ b/modules/dunst/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "dunst"; humanName = "Dunst"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/emacs/hm.nix b/modules/emacs/hm.nix index 70a2d776..0bb705fd 100644 --- a/modules/emacs/hm.nix +++ b/modules/emacs/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "emacs"; humanName = "Emacs"; - configElements = [ + config = [ ( { opacity }: { diff --git a/modules/eog/hm.nix b/modules/eog/hm.nix index 7f1cd9f9..ff5d3c32 100644 --- a/modules/eog/hm.nix +++ b/modules/eog/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "eog"; humanName = "Eye of GNOME Image Viewer"; - configElements = + config = { colors }: { dconf.settings."org/gnome/eog/view" = { diff --git a/modules/fcitx5/hm.nix b/modules/fcitx5/hm.nix index 7fbffb7d..91b03610 100644 --- a/modules/fcitx5/hm.nix +++ b/modules/fcitx5/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "fcitx5"; humanName = "fcitx5"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/feh/hm.nix b/modules/feh/hm.nix index d0187ebf..4b5c4d70 100644 --- a/modules/feh/hm.nix +++ b/modules/feh/hm.nix @@ -24,7 +24,7 @@ mkTarget { || xmonad.enable ''; - configElements = + config = { imageScalingMode, image }: { xsession.initExtra = diff --git a/modules/feh/nixos.nix b/modules/feh/nixos.nix index cc0ee85e..6049cc2c 100644 --- a/modules/feh/nixos.nix +++ b/modules/feh/nixos.nix @@ -16,7 +16,7 @@ mkTarget { xmonad.enable || i3.enable ''; - configElements = + config = { image, imageScalingMode }: { services.xserver.displayManager.sessionCommands = diff --git a/modules/firefox/each-config.nix b/modules/firefox/each-config.nix index eaaed89d..def60076 100644 --- a/modules/firefox/each-config.nix +++ b/modules/firefox/each-config.nix @@ -14,7 +14,7 @@ mkTarget { inherit name humanName; - extraOptions = { + options = { profileNames = lib.mkOption { description = "The ${humanName} profile names to apply styling on."; type = lib.types.listOf lib.types.str; @@ -26,7 +26,7 @@ mkTarget { firefoxGnomeTheme.enable = lib.mkEnableOption "[Firefox GNOME theme](https://github.com/rafaelmardojai/firefox-gnome-theme) on ${humanName}"; }; - configElements = [ + config = [ ( { cfg }: { diff --git a/modules/fish/hm.nix b/modules/fish/hm.nix index 9763c50b..f8e2f727 100644 --- a/modules/fish/hm.nix +++ b/modules/fish/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "fish"; humanName = "Fish"; - configElements = + config = { colors, inputs }: { programs.fish.interactiveShellInit = import ./prompt.nix { diff --git a/modules/fish/nixos.nix b/modules/fish/nixos.nix index 02affea0..f53e7f47 100644 --- a/modules/fish/nixos.nix +++ b/modules/fish/nixos.nix @@ -3,7 +3,7 @@ mkTarget { name = "fish"; humanName = "Fish"; - configElements = + config = { colors, inputs }: { programs.fish.promptInit = import ./prompt.nix { inherit colors inputs; }; diff --git a/modules/fnott/hm.nix b/modules/fnott/hm.nix index 984459b4..ff37d15c 100644 --- a/modules/fnott/hm.nix +++ b/modules/fnott/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "fnott"; humanName = "Fnott"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/foliate/hm.nix b/modules/foliate/hm.nix index 43ce4f3d..2d9b7a40 100644 --- a/modules/foliate/hm.nix +++ b/modules/foliate/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "foliate"; humanName = "Foliate"; - configElements = + config = { colors }: { programs.foliate = { diff --git a/modules/font-packages/darwin.nix b/modules/font-packages/darwin.nix index eac7fa35..6a067eb9 100644 --- a/modules/font-packages/darwin.nix +++ b/modules/font-packages/darwin.nix @@ -3,7 +3,7 @@ mkTarget { name = "font-packages"; humanName = "Font packages"; - configElements = + config = { fonts }: { fonts = { inherit (fonts) packages; }; diff --git a/modules/font-packages/hm.nix b/modules/font-packages/hm.nix index 3e730bd6..a45926b3 100644 --- a/modules/font-packages/hm.nix +++ b/modules/font-packages/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "font-packages"; humanName = "Font packages"; - configElements = + config = { fonts }: { home = { inherit (fonts) packages; }; diff --git a/modules/font-packages/nixos.nix b/modules/font-packages/nixos.nix index eac7fa35..6a067eb9 100644 --- a/modules/font-packages/nixos.nix +++ b/modules/font-packages/nixos.nix @@ -3,7 +3,7 @@ mkTarget { name = "font-packages"; humanName = "Font packages"; - configElements = + config = { fonts }: { fonts = { inherit (fonts) packages; }; diff --git a/modules/fontconfig/fontconfig.nix b/modules/fontconfig/fontconfig.nix index b2fadd2c..dc4cd3e6 100644 --- a/modules/fontconfig/fontconfig.nix +++ b/modules/fontconfig/fontconfig.nix @@ -4,7 +4,7 @@ mkTarget { name = "fontconfig"; humanName = "Fontconfig"; - configElements = + config = { listTargetIndex, fonts }: { fonts.fontconfig.defaultFonts = lib.genAttrs [ diff --git a/modules/foot/hm.nix b/modules/foot/hm.nix index b1afc764..9b3dde9a 100644 --- a/modules/foot/hm.nix +++ b/modules/foot/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "foot"; humanName = "Foot"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/forge/hm.nix b/modules/forge/hm.nix index 04000a72..c67d2ad0 100644 --- a/modules/forge/hm.nix +++ b/modules/forge/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "forge"; humanName = "Forge"; - configElements = + config = { colors }: { xdg.configFile."forge/stylesheet/forge/stylesheet.css".source = colors { diff --git a/modules/fuzzel/hm.nix b/modules/fuzzel/hm.nix index 29b4836f..0a3ab52d 100644 --- a/modules/fuzzel/hm.nix +++ b/modules/fuzzel/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "fuzzel"; humanName = "Fuzzel"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/fzf/hm.nix b/modules/fzf/hm.nix index 08df42e2..f748c515 100644 --- a/modules/fzf/hm.nix +++ b/modules/fzf/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "fzf"; humanName = "Fzf"; - configElements = + config = { colors }: { programs.fzf.colors = with colors.withHashtag; { diff --git a/modules/gdu/hm.nix b/modules/gdu/hm.nix index 6c2f57a7..a36b1635 100644 --- a/modules/gdu/hm.nix +++ b/modules/gdu/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "gdu"; humanName = "go DiskUsage()"; - configElements = + config = { colors }: { xdg.configFile."gdu/gdu.yaml" = { diff --git a/modules/gedit/hm.nix b/modules/gedit/hm.nix index b31c47ec..fa8f78ca 100644 --- a/modules/gedit/hm.nix +++ b/modules/gedit/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "gedit"; humanName = "GEdit"; - configElements = + config = { colors }: { xdg.dataFile = { diff --git a/modules/ghostty/hm.nix b/modules/ghostty/hm.nix index 5ebb8ef6..a2191935 100644 --- a/modules/ghostty/hm.nix +++ b/modules/ghostty/hm.nix @@ -6,7 +6,7 @@ mkTarget { name = "ghostty"; humanName = "Ghostty"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/gitui/hm.nix b/modules/gitui/hm.nix index 7246cd04..90b6e4df 100644 --- a/modules/gitui/hm.nix +++ b/modules/gitui/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "gitui"; humanName = "GitUI"; - configElements = + config = { colors }: { programs.gitui.theme = with colors.withHashtag; '' diff --git a/modules/glance/hm.nix b/modules/glance/hm.nix index 6448d12b..5ba9162f 100644 --- a/modules/glance/hm.nix +++ b/modules/glance/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "glance"; humanName = "Glance"; - configElements = [ + config = [ ( { polarity }: { diff --git a/modules/glance/nixos.nix b/modules/glance/nixos.nix index 6448d12b..5ba9162f 100644 --- a/modules/glance/nixos.nix +++ b/modules/glance/nixos.nix @@ -3,7 +3,7 @@ mkTarget { name = "glance"; humanName = "Glance"; - configElements = [ + config = [ ( { polarity }: { diff --git a/modules/gnome-text-editor/hm.nix b/modules/gnome-text-editor/hm.nix index 8caea6ba..c72ba084 100644 --- a/modules/gnome-text-editor/hm.nix +++ b/modules/gnome-text-editor/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "gnome-text-editor"; humanName = "GNOME Text Editor"; - configElements = { + config = { dconf.settings."org/gnome/TextEditor".style-scheme = "stylix"; }; } diff --git a/modules/gnome/hm.nix b/modules/gnome/hm.nix index f94add89..fe3cdf32 100644 --- a/modules/gnome/hm.nix +++ b/modules/gnome/hm.nix @@ -12,9 +12,9 @@ mkTarget { autoEnable = pkgs.stdenv.hostPlatform.isLinux; autoEnableExpr = "pkgs.stdenv.hostPlatform.isLinux"; - extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "GNOME" true; + options.useWallpaper = config.lib.stylix.mkEnableWallpaper "GNOME" true; - configElements = [ + config = [ ( { cfg, image }: { diff --git a/modules/gtk/hm.nix b/modules/gtk/hm.nix index 1a1d8aec..88ebf8b6 100644 --- a/modules/gtk/hm.nix +++ b/modules/gtk/hm.nix @@ -10,7 +10,7 @@ mkTarget { name = "gtk"; humanName = "all GTK3, GTK4 and Libadwaita apps"; - extraOptions = { + options = { extraCss = lib.mkOption { description = '' Extra code added to `gtk-3.0/gtk.css` and `gtk-4.0/gtk.css`. @@ -26,7 +26,7 @@ mkTarget { flatpakSupport.enable = config.lib.stylix.mkEnableTarget "support for theming Flatpak apps" true; }; - configElements = [ + config = [ { warnings = lib.optional (config.gtk.gtk3.extraCss != "" || config.gtk.gtk4.extraCss != "") diff --git a/modules/gtk/nixos.nix b/modules/gtk/nixos.nix index 90ff4712..2300f90b 100644 --- a/modules/gtk/nixos.nix +++ b/modules/gtk/nixos.nix @@ -3,7 +3,7 @@ mkTarget { name = "gtk"; humanName = "all GTK3, GTK4 and Libadwaita apps"; - configElements = { + config = { # Required for Home Manager's GTK settings to work programs.dconf.enable = true; }; diff --git a/modules/gtksourceview/hm.nix b/modules/gtksourceview/hm.nix index 5aa58b62..00bd9e76 100644 --- a/modules/gtksourceview/hm.nix +++ b/modules/gtksourceview/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "gtksourceview"; humanName = "GTKSourceView"; - configElements = + config = { colors, ... }: { xdg.dataFile = builtins.listToAttrs ( diff --git a/modules/halloy/hm.nix b/modules/halloy/hm.nix index b91f02c5..b10f0727 100644 --- a/modules/halloy/hm.nix +++ b/modules/halloy/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "halloy"; humanName = "Halloy"; - configElements = + config = { colors }: { programs.halloy = { diff --git a/modules/helix/hm.nix b/modules/helix/hm.nix index 28bbddaf..1b4403bb 100644 --- a/modules/helix/hm.nix +++ b/modules/helix/hm.nix @@ -8,12 +8,12 @@ mkTarget { name = "helix"; humanName = "Helix"; - extraOptions.transparent = lib.mkEnableOption "transparent theming" // { + options.transparent = lib.mkEnableOption "transparent theming" // { internal = true; default = false; }; - configElements = [ + config = [ ( { opacity }: { diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix index 119ba797..e15b7b29 100644 --- a/modules/hyprland/hm.nix +++ b/modules/hyprland/hm.nix @@ -7,7 +7,7 @@ mkTarget { name = "hyprland"; humanName = "Hyprland"; - extraOptions = + options = { image }: { hyprpaper.enable = config.lib.stylix.mkEnableTargetWith { @@ -17,7 +17,7 @@ mkTarget { }; }; - configElements = [ + config = [ ( { colors }: { diff --git a/modules/hyprlock/hm.nix b/modules/hyprlock/hm.nix index 6e644633..abd03139 100644 --- a/modules/hyprlock/hm.nix +++ b/modules/hyprlock/hm.nix @@ -8,9 +8,9 @@ mkTarget { name = "hyprlock"; humanName = "Hyprlock"; - extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprlock" true; + options.useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprlock" true; - configElements = [ + config = [ ( { cfg, image }: { diff --git a/modules/hyprpanel/hm.nix b/modules/hyprpanel/hm.nix index 32e38df8..fb44e9a5 100644 --- a/modules/hyprpanel/hm.nix +++ b/modules/hyprpanel/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "hyprpanel"; humanName = "HyprPanel"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/hyprpaper/hm.nix b/modules/hyprpaper/hm.nix index f088a3ed..e230f0c5 100644 --- a/modules/hyprpaper/hm.nix +++ b/modules/hyprpaper/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "hyprpaper"; humanName = "Hyprpaper"; - configElements = + config = { image }: { services.hyprpaper.settings = { diff --git a/modules/i3/hm.nix b/modules/i3/hm.nix index 6fccc166..019b4177 100644 --- a/modules/i3/hm.nix +++ b/modules/i3/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "i3"; humanName = "i3"; - extraOptions.exportedBarConfig = lib.mkOption { + options.exportedBarConfig = lib.mkOption { type = lib.types.attrs; default = { }; description = '' @@ -29,7 +29,7 @@ mkTarget { } ); - configElements = [ + config = [ ( { fonts }: let diff --git a/modules/i3bar-river/hm.nix b/modules/i3bar-river/hm.nix index cd48c10d..2bd22a0f 100644 --- a/modules/i3bar-river/hm.nix +++ b/modules/i3bar-river/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "i3bar-river"; humanName = "i3bar-river"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/jankyborders/darwin.nix b/modules/jankyborders/darwin.nix index 21a08fcc..e4948769 100644 --- a/modules/jankyborders/darwin.nix +++ b/modules/jankyborders/darwin.nix @@ -8,7 +8,7 @@ mkTarget { name = "jankyborders"; humanName = "JankyBorders"; - configElements = + config = { colors, opacity }: { services.jankyborders = diff --git a/modules/k9s/hm.nix b/modules/k9s/hm.nix index e172b99b..f0a0bc26 100644 --- a/modules/k9s/hm.nix +++ b/modules/k9s/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "k9s"; humanName = "k9s"; - configElements = + config = { colors }: { programs.k9s = { diff --git a/modules/kitty/hm.nix b/modules/kitty/hm.nix index 573d1985..d17b5262 100644 --- a/modules/kitty/hm.nix +++ b/modules/kitty/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "kitty"; humanName = "Kitty"; - extraOptions = { + options = { variant256Colors = lib.mkOption { description = '' Whether to use the [256-color variant](https://github.com/kdrag0n/base16-kitty#256-color-variants) @@ -14,7 +14,7 @@ mkTarget { }; }; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/kmscon/nixos.nix b/modules/kmscon/nixos.nix index 83c6f6b2..830e3828 100644 --- a/modules/kmscon/nixos.nix +++ b/modules/kmscon/nixos.nix @@ -3,7 +3,7 @@ mkTarget { name = "kmscon"; humanName = "the kmscon virtual console"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/kubecolor/hm.nix b/modules/kubecolor/hm.nix index 0670526c..4b461f84 100644 --- a/modules/kubecolor/hm.nix +++ b/modules/kubecolor/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "kubecolor"; humanName = "kubecolor"; - configElements = [ + config = [ ( { polarity }: { diff --git a/modules/lazygit/hm.nix b/modules/lazygit/hm.nix index d13c4601..50850ea4 100644 --- a/modules/lazygit/hm.nix +++ b/modules/lazygit/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "lazygit"; humanName = "lazygit"; - configElements = + config = { colors }: { programs.lazygit.settings.gui.theme = with colors.withHashtag; { diff --git a/modules/lightdm/nixos.nix b/modules/lightdm/nixos.nix index c7fa38ed..b0720711 100644 --- a/modules/lightdm/nixos.nix +++ b/modules/lightdm/nixos.nix @@ -8,9 +8,9 @@ mkTarget { name = "lightdm"; humanName = "LightDM"; - extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "LightDM" true; + options.useWallpaper = config.lib.stylix.mkEnableWallpaper "LightDM" true; - configElements = + config = { cfg, image }: { services.xserver.displayManager.lightdm.background = diff --git a/modules/limine/nixos.nix b/modules/limine/nixos.nix index 6a7294de..74b79071 100644 --- a/modules/limine/nixos.nix +++ b/modules/limine/nixos.nix @@ -8,9 +8,9 @@ mkTarget { name = "limine"; humanName = "Limine"; - extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "Limine" true; + options.useWallpaper = config.lib.stylix.mkEnableWallpaper "Limine" true; - configElements = [ + config = [ ( { colors }: { diff --git a/modules/mako/hm.nix b/modules/mako/hm.nix index 3314f0e5..312fab72 100644 --- a/modules/mako/hm.nix +++ b/modules/mako/hm.nix @@ -4,7 +4,7 @@ mkTarget { humanName = "Mako"; # Referenced https://github.com/stacyharper/base16-mako - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/mangohud/hm.nix b/modules/mangohud/hm.nix index cad9acc3..f513f9e0 100644 --- a/modules/mangohud/hm.nix +++ b/modules/mangohud/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "mangohud"; humanName = "mangohud"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/micro/hm.nix b/modules/micro/hm.nix index 36f26d11..a1a76db8 100644 --- a/modules/micro/hm.nix +++ b/modules/micro/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "micro"; humanName = "micro"; - configElements = { + config = { # TODO: Provide a real colorscheme once [1] is resolved. # # [1]: https://github.com/nix-community/stylix/issues/249 diff --git a/modules/mpv/hm.nix b/modules/mpv/hm.nix index 7cc67582..1c0db2fe 100644 --- a/modules/mpv/hm.nix +++ b/modules/mpv/hm.nix @@ -2,7 +2,7 @@ mkTarget { name = "mpv"; humanName = "mpv"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/ncspot/hm.nix b/modules/ncspot/hm.nix index e5192474..d03a9ec3 100644 --- a/modules/ncspot/hm.nix +++ b/modules/ncspot/hm.nix @@ -3,14 +3,14 @@ mkTarget { name = "ncspot"; humanName = "Ncspot"; - extraOptions.background = lib.mkOption { + options.background = lib.mkOption { type = lib.types.nullOr lib.types.str; description = "Used to set bg even if `opacity` or `colors` is null."; internal = true; default = null; }; - configElements = [ + config = [ ( { cfg }: lib.mkIf (cfg.background != null) { diff --git a/modules/neovim/neovide.nix b/modules/neovim/neovide.nix index 519949b7..5dc67924 100644 --- a/modules/neovim/neovide.nix +++ b/modules/neovim/neovide.nix @@ -3,7 +3,7 @@ mkTarget: mkTarget { name = "neovide"; humanName = "Neovide"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/neovim/neovim.nix b/modules/neovim/neovim.nix index 62161ebd..fef4c98e 100644 --- a/modules/neovim/neovim.nix +++ b/modules/neovim/neovim.nix @@ -3,7 +3,7 @@ mkTarget: mkTarget { name = "neovim"; humanName = "Neovim"; - extraOptions = { + options = { plugin = lib.mkOption { type = lib.types.enum [ "base16-nvim" @@ -25,7 +25,7 @@ mkTarget { }; }; - configElements = [ + config = [ ( { colors, cfg }: { diff --git a/modules/neovim/nixvim.nix b/modules/neovim/nixvim.nix index 2dc091c2..b9a7e49b 100644 --- a/modules/neovim/nixvim.nix +++ b/modules/neovim/nixvim.nix @@ -3,7 +3,7 @@ mkTarget: mkTarget { name = "nixvim"; humanName = "NixVim"; - extraOptions = { + options = { plugin = lib.mkOption { type = lib.types.enum [ "base16-nvim" @@ -37,7 +37,7 @@ mkTarget { }; }; - configElements = [ + config = [ ( { colors }: { diff --git a/modules/neovim/nvf.nix b/modules/neovim/nvf.nix index 88ed74ff..8aa22438 100644 --- a/modules/neovim/nvf.nix +++ b/modules/neovim/nvf.nix @@ -3,7 +3,7 @@ mkTarget: mkTarget { name = "nvf"; humanName = "nvf"; - extraOptions = { + options = { plugin = lib.mkOption { type = lib.types.enum [ "base16" @@ -15,7 +15,7 @@ mkTarget { transparentBackground = lib.mkEnableOption "background transparency for the main Neovim window"; }; - configElements = lib.optionals (options.programs ? nvf) [ + config = lib.optionals (options.programs ? nvf) [ ( { colors, cfg }: { diff --git a/modules/neovim/vim.nix b/modules/neovim/vim.nix index 20bc48b3..84effd99 100644 --- a/modules/neovim/vim.nix +++ b/modules/neovim/vim.nix @@ -4,7 +4,7 @@ mkTarget { name = "vim"; humanName = "Vim"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/nushell/hm.nix b/modules/nushell/hm.nix index 05d6f0a6..61a4b164 100644 --- a/modules/nushell/hm.nix +++ b/modules/nushell/hm.nix @@ -4,7 +4,7 @@ mkTarget { humanName = "Nushell"; # Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming - configElements = + config = { colors }: { programs.nushell.extraConfig = with colors.withHashtag; '' diff --git a/modules/obsidian/hm.nix b/modules/obsidian/hm.nix index ecaa66e5..017b5a8f 100644 --- a/modules/obsidian/hm.nix +++ b/modules/obsidian/hm.nix @@ -3,13 +3,13 @@ mkTarget { name = "obsidian"; humanName = "Obsidian"; - extraOptions.vaultNames = lib.mkOption { + options.vaultNames = lib.mkOption { description = "The obsidian vault names to apply styling on."; type = lib.types.listOf lib.types.str; default = [ ]; }; - configElements = [ + config = [ ( { cfg, fonts }: { diff --git a/modules/opencode/hm.nix b/modules/opencode/hm.nix index bb603458..edbd04d0 100644 --- a/modules/opencode/hm.nix +++ b/modules/opencode/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "opencode"; humanName = "OpenCode"; - configElements = + config = { colors }: { programs.opencode = diff --git a/modules/plymouth/nixos.nix b/modules/plymouth/nixos.nix index acb1c48d..06cffbef 100644 --- a/modules/plymouth/nixos.nix +++ b/modules/plymouth/nixos.nix @@ -8,7 +8,7 @@ mkTarget { name = "plymouth"; humanName = "the Plymouth boot screen"; - extraOptions = { + options = { logo = lib.mkOption { description = "Logo to be used on the boot screen."; type = with lib.types; either path package; @@ -35,7 +35,7 @@ mkTarget { ) ]; - configElements = + config = { cfg, colors }: let themeScript = import ./theme-script.nix { inherit lib cfg colors; }; diff --git a/modules/qutebrowser/hm.nix b/modules/qutebrowser/hm.nix index 1f2e0158..4996a1f5 100644 --- a/modules/qutebrowser/hm.nix +++ b/modules/qutebrowser/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "qutebrowser"; humanName = "Qutebrowser"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/regreet/nixos.nix b/modules/regreet/nixos.nix index ce77a5eb..81f66933 100644 --- a/modules/regreet/nixos.nix +++ b/modules/regreet/nixos.nix @@ -12,7 +12,7 @@ mkTarget { autoEnable = pkgs.stdenv.hostPlatform.isLinux; autoEnableExpr = "pkgs.stdenv.hostPlatform.isLinux"; - extraOptions = { + options = { useWallpaper = config.lib.stylix.mkEnableWallpaper "ReGreet" true; extraCss = lib.mkOption { description = '' @@ -24,7 +24,7 @@ mkTarget { }; }; - configElements = [ + config = [ { warnings = let diff --git a/modules/rio/hm.nix b/modules/rio/hm.nix index ac6bdb5e..e518670c 100644 --- a/modules/rio/hm.nix +++ b/modules/rio/hm.nix @@ -5,7 +5,7 @@ mkTarget { name = "rio"; humanName = "Rio"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/rofi/hm.nix b/modules/rofi/hm.nix index a0b03942..fbb8ce0c 100644 --- a/modules/rofi/hm.nix +++ b/modules/rofi/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "rofi"; humanName = "Rofi"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/spicetify/spicetify.nix b/modules/spicetify/spicetify.nix index 045230c6..c1af818c 100644 --- a/modules/spicetify/spicetify.nix +++ b/modules/spicetify/spicetify.nix @@ -9,7 +9,7 @@ mkTarget { name = "spicetify"; humanName = "Spicetify"; - configElements = + config = { colors }: lib.optionalAttrs (options.programs ? spicetify) { programs.spicetify = { diff --git a/modules/spotify-player/hm.nix b/modules/spotify-player/hm.nix index 6df7c5d8..a3745fe2 100644 --- a/modules/spotify-player/hm.nix +++ b/modules/spotify-player/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "spotify-player"; humanName = "spotify-player"; - configElements = + config = { colors }: { programs.spotify-player = { diff --git a/modules/starship/hm.nix b/modules/starship/hm.nix index bdcc4a1f..44aa23b9 100644 --- a/modules/starship/hm.nix +++ b/modules/starship/hm.nix @@ -4,7 +4,7 @@ mkTarget { name = "starship"; humanName = "Starship"; - configElements = + config = { colors }: { programs.starship.settings = { diff --git a/modules/swaylock/hm.nix b/modules/swaylock/hm.nix index 910ef72f..0e2219e2 100644 --- a/modules/swaylock/hm.nix +++ b/modules/swaylock/hm.nix @@ -26,9 +26,9 @@ mkTarget { lib.versionAtLeast config.home.stateVersion "23.05" && pkgs.stdenv.hostPlatform.isLinux ''; - extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "Swaylock" true; + options.useWallpaper = config.lib.stylix.mkEnableWallpaper "Swaylock" true; - configElements = [ + config = [ ( { colors }: { diff --git a/modules/swaync/hm.nix b/modules/swaync/hm.nix index 271a437d..1670e287 100644 --- a/modules/swaync/hm.nix +++ b/modules/swaync/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "swaync"; humanName = "SwayNC"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/sxiv/hm.nix b/modules/sxiv/hm.nix index 6fce9add..ddd40e9f 100644 --- a/modules/sxiv/hm.nix +++ b/modules/sxiv/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "sxiv"; humanName = "Sxiv"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/tmux/hm.nix b/modules/tmux/hm.nix index 44310c10..6d3c8538 100644 --- a/modules/tmux/hm.nix +++ b/modules/tmux/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "tmux"; humanName = "Tmux"; - configElements = + config = { colors, inputs }: { programs.tmux.extraConfig = '' diff --git a/modules/tofi/hm.nix b/modules/tofi/hm.nix index 5e68f946..a9b43ab0 100644 --- a/modules/tofi/hm.nix +++ b/modules/tofi/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "tofi"; humanName = "Tofi"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/vicinae/hm.nix b/modules/vicinae/hm.nix index fc17baa3..53dab221 100644 --- a/modules/vicinae/hm.nix +++ b/modules/vicinae/hm.nix @@ -8,7 +8,7 @@ mkTarget { name = "vicinae"; humanName = "Vicinae"; - configElements = lib.optionals (options.services ? vicinae) [ + config = lib.optionals (options.services ? vicinae) [ ( { colors, polarity }: { diff --git a/modules/vivid/hm.nix b/modules/vivid/hm.nix index a76f522f..66de1086 100644 --- a/modules/vivid/hm.nix +++ b/modules/vivid/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "vivid"; humanName = "vivid"; - configElements = + config = { colors }: let theme = "stylix"; diff --git a/modules/vscode/hm.nix b/modules/vscode/hm.nix index 42b3fcc9..c4d7d72f 100644 --- a/modules/vscode/hm.nix +++ b/modules/vscode/hm.nix @@ -9,13 +9,13 @@ mkTarget { name = "vscode"; humanName = "VSCode"; - extraOptions.profileNames = lib.mkOption { + options.profileNames = lib.mkOption { description = "The VSCode profile names to apply styling on."; type = lib.types.listOf lib.types.str; default = [ "default" ]; }; - configElements = [ + config = [ ( { cfg }: { diff --git a/modules/waybar/hm.nix b/modules/waybar/hm.nix index 9c5c166a..e0be29d2 100644 --- a/modules/waybar/hm.nix +++ b/modules/waybar/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "waybar"; humanName = "Waybar"; - extraOptions = { + options = { background = lib.mkOption { type = lib.types.nullOr lib.types.str; description = "Used to set bg even if `opacity` or `colors` is null"; @@ -43,7 +43,7 @@ mkTarget { }; }; - configElements = [ + config = [ ( { cfg }: { diff --git a/modules/wayfire/hm.nix b/modules/wayfire/hm.nix index 437cc6bb..b3723ea3 100644 --- a/modules/wayfire/hm.nix +++ b/modules/wayfire/hm.nix @@ -9,9 +9,9 @@ mkTarget { name = "wayfire"; humanName = "Wayfire"; - extraOptions.useWallpaper = config.lib.stylix.mkEnableWallpaper "wayfire" true; + options.useWallpaper = config.lib.stylix.mkEnableWallpaper "wayfire" true; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/wayprompt/hm.nix b/modules/wayprompt/hm.nix index 8f5486a5..b88bc3f8 100644 --- a/modules/wayprompt/hm.nix +++ b/modules/wayprompt/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "wayprompt"; humanName = "Wayprompt"; - configElements = + config = { colors, opacity }: let opacity' = lib.toHexString (builtins.ceil (opacity.popups * 255)); diff --git a/modules/wezterm/hm.nix b/modules/wezterm/hm.nix index cd26a74e..92d08410 100644 --- a/modules/wezterm/hm.nix +++ b/modules/wezterm/hm.nix @@ -7,12 +7,12 @@ mkTarget { name = "wezterm"; humanName = "WezTerm"; - extraOptions.luaBody = lib.mkOption { + options.luaBody = lib.mkOption { type = lib.types.lines; default = ""; internal = true; }; - configElements = [ + config = [ ( { colors }: with colors; diff --git a/modules/wob/hm.nix b/modules/wob/hm.nix index 6e2b7cef..d7b5f29d 100644 --- a/modules/wob/hm.nix +++ b/modules/wob/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "wob"; humanName = "wob"; - configElements = + config = { colors }: { services.wob.settings = { diff --git a/modules/wofi/hm.nix b/modules/wofi/hm.nix index 7a4684e3..eb816d59 100644 --- a/modules/wofi/hm.nix +++ b/modules/wofi/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "wofi"; humanName = "wofi"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/wpaperd/hm.nix b/modules/wpaperd/hm.nix index 2ee840e4..23fbefb9 100644 --- a/modules/wpaperd/hm.nix +++ b/modules/wpaperd/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "wpaperd"; humanName = "wpaperd"; - configElements = + config = { imageScalingMode, image }: ( let diff --git a/modules/xfce/hm.nix b/modules/xfce/hm.nix index 0eeae1b7..f258d7ea 100644 --- a/modules/xfce/hm.nix +++ b/modules/xfce/hm.nix @@ -5,7 +5,7 @@ mkTarget { # Disabled by default due to https://github.com/nix-community/stylix/issues/180 autoEnable = false; - configElements = + config = { fonts }: { xfconf.settings = with fonts; { diff --git a/modules/xresources/hm.nix b/modules/xresources/hm.nix index 3a9fafb8..826e1ce0 100644 --- a/modules/xresources/hm.nix +++ b/modules/xresources/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "xresources"; humanName = "Xresources"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/yazi/hm.nix b/modules/yazi/hm.nix index 397f8874..c028b45f 100644 --- a/modules/yazi/hm.nix +++ b/modules/yazi/hm.nix @@ -4,13 +4,13 @@ mkTarget { name = "yazi"; humanName = "Yazi"; - extraOptions.boldDirectory = lib.mkOption { + options.boldDirectory = lib.mkOption { description = "Whether to use bold font for directories."; type = lib.types.bool; default = true; }; - configElements = + config = { cfg, colors }: { programs.yazi.theme = diff --git a/modules/zathura/hm.nix b/modules/zathura/hm.nix index cfaec37e..08c30af8 100644 --- a/modules/zathura/hm.nix +++ b/modules/zathura/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "zathura"; humanName = "Zathura"; - configElements = + config = { colors, opacity }: { programs.zathura.options = diff --git a/modules/zed/hm.nix b/modules/zed/hm.nix index 29155344..6e030866 100644 --- a/modules/zed/hm.nix +++ b/modules/zed/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "zed"; humanName = "zed"; - configElements = [ + config = [ ( { fonts }: { diff --git a/modules/zellij/hm.nix b/modules/zellij/hm.nix index 2580aa6a..bca443d9 100644 --- a/modules/zellij/hm.nix +++ b/modules/zellij/hm.nix @@ -3,7 +3,7 @@ mkTarget { name = "zellij"; humanName = "zellij"; - configElements = + config = { colors }: { programs.zellij.themes.stylix = { diff --git a/modules/zen-browser/hm.nix b/modules/zen-browser/hm.nix index 04495db1..44d97cce 100644 --- a/modules/zen-browser/hm.nix +++ b/modules/zen-browser/hm.nix @@ -9,7 +9,7 @@ mkTarget { name = "zen-browser"; humanName = "Zen Browser"; - extraOptions = { + options = { profileNames = lib.mkOption { description = "The Zen Browser profile names to apply styling on."; type = lib.types.listOf lib.types.str; @@ -25,7 +25,7 @@ mkTarget { }; }; - configElements = lib.optionals (options.programs ? zen-browser) [ + config = lib.optionals (options.programs ? zen-browser) [ ( { cfg }: { diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index aa3a1b68..f987c3d9 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -27,7 +27,7 @@ home.packages = [ pkgs.hello ]; }; - configElements = [ + config = [ { programs.«name».theme.name = "stylix"; } ( @@ -82,7 +82,7 @@ The default (`true`) is inherited from `mkEnableTargetWith`. - `configElements` (List or attribute set or function or path) + `config` (List or attribute set or function or path) : Configuration functions that are automatically safeguarded when any of their arguments is disabled. The provided `cfg` argument conveniently aliases to `config.stylix.targets.${name}`. @@ -115,7 +115,10 @@ automatically by `mkEnableTargetWith` and depends on `autoEnable` and whether an `autoEnableExpr` is used. - `extraOptions` (Attribute set) +   `imports` (List) +   : The `imports` option forwarded to the Nixpkgs module system. + + `options` (Attribute set) : Additional options to be added in the `stylix.targets.${name}` namespace along the `stylix.targets.${name}.enable` option. @@ -125,13 +128,10 @@ { extension.enable = lib.mkEnableOption "the bloated dependency"; } ``` -   `imports` (List) -   : The `imports` option forwarded to the Nixpkgs module system. - `unconditionalConfig` (Attribute set or function or path) - : This argument mirrors the `configElements` argument but intentionally - lacks automatic safeguarding and should only be used for complex - configurations where `configElements` is unsuitable. + : This argument mirrors the `config` argument but intentionally lacks + automatic safeguarding and should only be used for complex configurations + where `config` is unsuitable. # Environment @@ -155,7 +155,7 @@ # home.packages = [ pkgs.hello ]; # }; # -# configElements = [ +# config = [ # { programs.example.theme.name = "stylix"; } # # ( @@ -179,13 +179,15 @@ autoEnable ? null, autoEnableExpr ? null, autoWrapEnableExpr ? null, - configElements ? [ ], + config ? [ ], enableExample ? null, - extraOptions ? { }, imports ? [ ], + options ? { }, unconditionalConfig ? { }, }@args: let + mkTargetConfig = config; + module = { config, lib, ... }: let @@ -250,7 +252,7 @@ let in { imports = imports ++ [ - { options.stylix.targets.${name} = callModule false extraOptions; } + { options.stylix.targets.${name} = callModule false options; } ]; options.stylix.targets.${name}.enable = @@ -270,7 +272,7 @@ let config = lib.mkIf (config.stylix.enable && cfg.enable) ( lib.mkMerge ( lib.singleton (callModule false unconditionalConfig) - ++ map (callModule true) (lib.toList configElements) + ++ map (callModule true) (lib.toList mkTargetConfig) ) ); }; From dfc859f54d937a31b954901ed01f3d6961cd2ead Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:28:36 +0200 Subject: [PATCH 08/10] treewide: optionalize mkTarget's humanName and name arguments Optionalize mkTarget's 'humanName' and 'name' arguments by inferring 'humanName' from the 'name' attribute in the /modules//meta.nix file, and 'name' from the /modules// directory name. Inferring the 'humanName' and 'name' arguments ensures consistency and reduces boilerplate. The 'humanName' and 'name' arguments are optionalized instead of removed because complex modules generating target derivations need to distinguish between them. Closes: https://github.com/nix-community/stylix/issues/1661 --- doc/src/modules.md | 3 --- modules/alacritty/hm.nix | 2 -- modules/anki/hm.nix | 3 --- modules/ashell/hm.nix | 3 --- modules/avizo/hm.nix | 3 --- modules/bat/hm.nix | 3 --- modules/bemenu/hm.nix | 3 --- modules/blender/hm.nix | 3 --- modules/bspwm/hm.nix | 3 --- modules/btop/hm.nix | 3 --- modules/cava/hm.nix | 3 --- modules/cavalier/hm.nix | 3 --- modules/chromium/nixos.nix | 3 --- modules/console/droid.nix | 3 --- modules/console/nixos.nix | 3 --- modules/dunst/hm.nix | 3 --- modules/emacs/hm.nix | 3 --- modules/eog/hm.nix | 3 --- modules/fcitx5/hm.nix | 3 --- modules/feh/hm.nix | 2 -- modules/feh/nixos.nix | 2 -- modules/firefox/each-config.nix | 2 +- modules/fish/hm.nix | 3 --- modules/fish/nixos.nix | 3 --- modules/fnott/hm.nix | 3 --- modules/foliate/hm.nix | 3 --- modules/font-packages/darwin.nix | 3 --- modules/font-packages/hm.nix | 3 --- modules/font-packages/nixos.nix | 3 --- modules/fontconfig/fontconfig.nix | 3 --- modules/foot/hm.nix | 3 --- modules/forge/hm.nix | 3 --- modules/fuzzel/hm.nix | 3 --- modules/fzf/hm.nix | 3 --- modules/gdu/hm.nix | 3 --- modules/gedit/hm.nix | 3 --- modules/ghostty/hm.nix | 3 --- modules/gitui/hm.nix | 3 --- modules/glance/hm.nix | 3 --- modules/glance/nixos.nix | 3 --- modules/gnome-text-editor/hm.nix | 3 --- modules/gnome-text-editor/nixos.nix | 6 +----- modules/gnome/hm.nix | 3 --- modules/gtk/hm.nix | 3 --- modules/gtk/nixos.nix | 3 --- modules/gtksourceview/hm.nix | 3 --- modules/gtksourceview/nixos.nix | 8 ++----- modules/halloy/hm.nix | 3 --- modules/helix/hm.nix | 3 --- modules/hyprland/hm.nix | 2 -- modules/hyprlock/hm.nix | 3 --- modules/hyprpanel/hm.nix | 3 --- modules/hyprpaper/hm.nix | 3 --- modules/i3/hm.nix | 3 --- modules/i3bar-river/hm.nix | 3 --- modules/jankyborders/darwin.nix | 3 --- modules/k9s/hm.nix | 3 --- modules/kitty/hm.nix | 3 --- modules/kmscon/nixos.nix | 3 --- modules/kubecolor/hm.nix | 3 --- modules/lazygit/hm.nix | 3 --- modules/lightdm/nixos.nix | 3 --- modules/limine/nixos.nix | 3 --- modules/mako/hm.nix | 3 --- modules/mangohud/hm.nix | 3 --- modules/micro/hm.nix | 3 --- modules/mpv/hm.nix | 2 -- modules/ncspot/hm.nix | 3 --- modules/nushell/hm.nix | 3 --- modules/obsidian/hm.nix | 3 --- modules/opencode/hm.nix | 3 --- modules/plymouth/nixos.nix | 3 --- modules/qutebrowser/hm.nix | 3 --- modules/regreet/nixos.nix | 3 --- modules/rio/hm.nix | 3 --- modules/rofi/hm.nix | 3 --- modules/spicetify/spicetify.nix | 3 --- modules/spotify-player/hm.nix | 3 --- modules/starship/hm.nix | 3 --- modules/swaylock/hm.nix | 3 --- modules/swaync/hm.nix | 3 --- modules/sxiv/hm.nix | 3 --- modules/tmux/hm.nix | 3 --- modules/tofi/hm.nix | 3 --- modules/vicinae/hm.nix | 3 --- modules/vivid/hm.nix | 3 --- modules/vscode/hm.nix | 3 --- modules/waybar/hm.nix | 3 --- modules/wayfire/hm.nix | 3 --- modules/wayprompt/hm.nix | 3 --- modules/wezterm/hm.nix | 2 -- modules/wob/hm.nix | 3 --- modules/wofi/hm.nix | 3 --- modules/wpaperd/hm.nix | 3 --- modules/xfce/hm.nix | 2 -- modules/xresources/hm.nix | 3 --- modules/yazi/hm.nix | 3 --- modules/zathura/hm.nix | 3 --- modules/zed/hm.nix | 3 --- modules/zellij/hm.nix | 3 --- modules/zen-browser/hm.nix | 3 --- stylix/autoload.nix | 10 +++++++-- stylix/darwin/default.nix | 9 ++++++-- stylix/droid/default.nix | 4 ++-- stylix/hm/default.nix | 9 ++++++-- stylix/mk-target.nix | 33 ++++++++++++++--------------- stylix/nixos/default.nix | 9 ++++++-- stylix/overlays.nix | 2 +- 108 files changed, 52 insertions(+), 327 deletions(-) diff --git a/doc/src/modules.md b/doc/src/modules.md index 75e91cdb..95c4e932 100644 --- a/doc/src/modules.md +++ b/doc/src/modules.md @@ -49,9 +49,6 @@ documentation for more details): ```nix { config, lib, mkTarget ... }: mkTarget { - name = "«name»"; - humanName = "«human readable name»"; - config = { colors }: { diff --git a/modules/alacritty/hm.nix b/modules/alacritty/hm.nix index f2fba176..eb9bbfd6 100644 --- a/modules/alacritty/hm.nix +++ b/modules/alacritty/hm.nix @@ -3,8 +3,6 @@ # - `man 5 alacritty` { mkTarget, ... }: mkTarget { - name = "alacritty"; - humanName = "Alacritty"; config = [ ( { colors }: diff --git a/modules/anki/hm.nix b/modules/anki/hm.nix index 6c70413d..2276c4d6 100644 --- a/modules/anki/hm.nix +++ b/modules/anki/hm.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "anki"; - humanName = "Anki"; - config = { colors }: { diff --git a/modules/ashell/hm.nix b/modules/ashell/hm.nix index 76830f91..e369229d 100644 --- a/modules/ashell/hm.nix +++ b/modules/ashell/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "ashell"; - humanName = "Ashell"; - config = [ ( { colors }: diff --git a/modules/avizo/hm.nix b/modules/avizo/hm.nix index 21de0fa2..60696649 100644 --- a/modules/avizo/hm.nix +++ b/modules/avizo/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "avizo"; - humanName = "Avizo"; - # Referenced https://github.com/stacyharper/base16-mako config = { colors, opacity }: diff --git a/modules/bat/hm.nix b/modules/bat/hm.nix index 48ab60c7..c9bf3475 100644 --- a/modules/bat/hm.nix +++ b/modules/bat/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "bat"; - humanName = "Bat"; - config = { colors }: { diff --git a/modules/bemenu/hm.nix b/modules/bemenu/hm.nix index 0438ea75..ee7817b6 100644 --- a/modules/bemenu/hm.nix +++ b/modules/bemenu/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "bemenu"; - humanName = "bemenu"; - options = { fonts }: { diff --git a/modules/blender/hm.nix b/modules/blender/hm.nix index b042fe38..4971ebd7 100644 --- a/modules/blender/hm.nix +++ b/modules/blender/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "blender"; - humanName = "Blender"; - options.themeBody = lib.mkOption { type = lib.types.lines; default = ""; diff --git a/modules/bspwm/hm.nix b/modules/bspwm/hm.nix index b30bcd86..54596468 100644 --- a/modules/bspwm/hm.nix +++ b/modules/bspwm/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "bspwm"; - humanName = "bspwm"; - config = { colors }: { diff --git a/modules/btop/hm.nix b/modules/btop/hm.nix index eb46381b..a6792c79 100644 --- a/modules/btop/hm.nix +++ b/modules/btop/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "btop"; - humanName = "btop"; - config = [ ( { opacity }: diff --git a/modules/cava/hm.nix b/modules/cava/hm.nix index 5fbfb08a..0a793165 100644 --- a/modules/cava/hm.nix +++ b/modules/cava/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "cava"; - humanName = "CAVA"; - options.rainbow.enable = lib.mkEnableOption "rainbow gradient theming"; config = diff --git a/modules/cavalier/hm.nix b/modules/cavalier/hm.nix index b922e71a..3e106048 100644 --- a/modules/cavalier/hm.nix +++ b/modules/cavalier/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "cavalier"; - humanName = "Cavalier"; - config = { colors }: { diff --git a/modules/chromium/nixos.nix b/modules/chromium/nixos.nix index 4154809c..fa20b10a 100644 --- a/modules/chromium/nixos.nix +++ b/modules/chromium/nixos.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "chromium"; - humanName = "Chromium, Google Chrome and Brave"; - config = { colors }: { diff --git a/modules/console/droid.nix b/modules/console/droid.nix index bb7fc37a..087426c6 100644 --- a/modules/console/droid.nix +++ b/modules/console/droid.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "console"; - humanName = "the Nix-on-Droid console"; - config = { colors }: { diff --git a/modules/console/nixos.nix b/modules/console/nixos.nix index 9c1230e0..9f1ddf12 100644 --- a/modules/console/nixos.nix +++ b/modules/console/nixos.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "console"; - humanName = "the Linux kernel console"; - config = { colors }: { diff --git a/modules/dunst/hm.nix b/modules/dunst/hm.nix index 61911221..d83b35fc 100644 --- a/modules/dunst/hm.nix +++ b/modules/dunst/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "dunst"; - humanName = "Dunst"; - config = [ ( { fonts }: diff --git a/modules/emacs/hm.nix b/modules/emacs/hm.nix index 0bb705fd..6b7827f9 100644 --- a/modules/emacs/hm.nix +++ b/modules/emacs/hm.nix @@ -1,8 +1,5 @@ { mkTarget, pkgs, ... }: mkTarget { - name = "emacs"; - humanName = "Emacs"; - config = [ ( { opacity }: diff --git a/modules/eog/hm.nix b/modules/eog/hm.nix index ff5d3c32..9e88c888 100644 --- a/modules/eog/hm.nix +++ b/modules/eog/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "eog"; - humanName = "Eye of GNOME Image Viewer"; - config = { colors }: { diff --git a/modules/fcitx5/hm.nix b/modules/fcitx5/hm.nix index 91b03610..ee31f5eb 100644 --- a/modules/fcitx5/hm.nix +++ b/modules/fcitx5/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "fcitx5"; - humanName = "fcitx5"; - config = [ ( { fonts }: diff --git a/modules/feh/hm.nix b/modules/feh/hm.nix index 4b5c4d70..0b1fa739 100644 --- a/modules/feh/hm.nix +++ b/modules/feh/hm.nix @@ -6,8 +6,6 @@ ... }: mkTarget { - name = "feh"; - humanName = "the desktop background using Feh"; autoEnable = with config.xsession.windowManager; bspwm.enable diff --git a/modules/feh/nixos.nix b/modules/feh/nixos.nix index 6049cc2c..3debf1a9 100644 --- a/modules/feh/nixos.nix +++ b/modules/feh/nixos.nix @@ -6,8 +6,6 @@ ... }: mkTarget { - name = "feh"; - humanName = "the desktop background using Feh"; autoEnable = with config.services.xserver.windowManager; xmonad.enable || i3.enable; diff --git a/modules/firefox/each-config.nix b/modules/firefox/each-config.nix index def60076..82b730d0 100644 --- a/modules/firefox/each-config.nix +++ b/modules/firefox/each-config.nix @@ -12,7 +12,7 @@ ... }: mkTarget { - inherit name humanName; + inherit humanName name; options = { profileNames = lib.mkOption { diff --git a/modules/fish/hm.nix b/modules/fish/hm.nix index f8e2f727..6acc5e13 100644 --- a/modules/fish/hm.nix +++ b/modules/fish/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "fish"; - humanName = "Fish"; - config = { colors, inputs }: { diff --git a/modules/fish/nixos.nix b/modules/fish/nixos.nix index f53e7f47..8487e280 100644 --- a/modules/fish/nixos.nix +++ b/modules/fish/nixos.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "fish"; - humanName = "Fish"; - config = { colors, inputs }: { diff --git a/modules/fnott/hm.nix b/modules/fnott/hm.nix index ff37d15c..473b9398 100644 --- a/modules/fnott/hm.nix +++ b/modules/fnott/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "fnott"; - humanName = "Fnott"; - config = [ ( { fonts }: diff --git a/modules/foliate/hm.nix b/modules/foliate/hm.nix index 2d9b7a40..01a29b9a 100644 --- a/modules/foliate/hm.nix +++ b/modules/foliate/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "foliate"; - humanName = "Foliate"; - config = { colors }: { diff --git a/modules/font-packages/darwin.nix b/modules/font-packages/darwin.nix index 6a067eb9..359d862d 100644 --- a/modules/font-packages/darwin.nix +++ b/modules/font-packages/darwin.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "font-packages"; - humanName = "Font packages"; - config = { fonts }: { diff --git a/modules/font-packages/hm.nix b/modules/font-packages/hm.nix index a45926b3..c2097750 100644 --- a/modules/font-packages/hm.nix +++ b/modules/font-packages/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "font-packages"; - humanName = "Font packages"; - config = { fonts }: { diff --git a/modules/font-packages/nixos.nix b/modules/font-packages/nixos.nix index 6a067eb9..359d862d 100644 --- a/modules/font-packages/nixos.nix +++ b/modules/font-packages/nixos.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "font-packages"; - humanName = "Font packages"; - config = { fonts }: { diff --git a/modules/fontconfig/fontconfig.nix b/modules/fontconfig/fontconfig.nix index dc4cd3e6..77eadf1a 100644 --- a/modules/fontconfig/fontconfig.nix +++ b/modules/fontconfig/fontconfig.nix @@ -1,9 +1,6 @@ { mkTarget }: { lib, ... }: mkTarget { - name = "fontconfig"; - humanName = "Fontconfig"; - config = { listTargetIndex, fonts }: { diff --git a/modules/foot/hm.nix b/modules/foot/hm.nix index 9b3dde9a..08ed47d1 100644 --- a/modules/foot/hm.nix +++ b/modules/foot/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "foot"; - humanName = "Foot"; - config = [ ( { fonts }: diff --git a/modules/forge/hm.nix b/modules/forge/hm.nix index c67d2ad0..330d2ae1 100644 --- a/modules/forge/hm.nix +++ b/modules/forge/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "forge"; - humanName = "Forge"; - config = { colors }: { diff --git a/modules/fuzzel/hm.nix b/modules/fuzzel/hm.nix index 0a3ab52d..7d7a1db2 100644 --- a/modules/fuzzel/hm.nix +++ b/modules/fuzzel/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "fuzzel"; - humanName = "Fuzzel"; - config = [ ( { fonts }: diff --git a/modules/fzf/hm.nix b/modules/fzf/hm.nix index f748c515..dda229b2 100644 --- a/modules/fzf/hm.nix +++ b/modules/fzf/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "fzf"; - humanName = "Fzf"; - config = { colors }: { diff --git a/modules/gdu/hm.nix b/modules/gdu/hm.nix index a36b1635..c1f2e4b4 100644 --- a/modules/gdu/hm.nix +++ b/modules/gdu/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "gdu"; - humanName = "go DiskUsage()"; - config = { colors }: { diff --git a/modules/gedit/hm.nix b/modules/gedit/hm.nix index fa8f78ca..82959a30 100644 --- a/modules/gedit/hm.nix +++ b/modules/gedit/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "gedit"; - humanName = "GEdit"; - config = { colors }: { diff --git a/modules/ghostty/hm.nix b/modules/ghostty/hm.nix index a2191935..a3ffec41 100644 --- a/modules/ghostty/hm.nix +++ b/modules/ghostty/hm.nix @@ -3,9 +3,6 @@ # - `man 5 ghostty` { mkTarget, pkgs, ... }: mkTarget { - name = "ghostty"; - humanName = "Ghostty"; - config = [ ( { fonts }: diff --git a/modules/gitui/hm.nix b/modules/gitui/hm.nix index 90b6e4df..aba87841 100644 --- a/modules/gitui/hm.nix +++ b/modules/gitui/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "gitui"; - humanName = "GitUI"; - config = { colors }: { diff --git a/modules/glance/hm.nix b/modules/glance/hm.nix index 5ba9162f..da68e487 100644 --- a/modules/glance/hm.nix +++ b/modules/glance/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "glance"; - humanName = "Glance"; - config = [ ( { polarity }: diff --git a/modules/glance/nixos.nix b/modules/glance/nixos.nix index 5ba9162f..da68e487 100644 --- a/modules/glance/nixos.nix +++ b/modules/glance/nixos.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "glance"; - humanName = "Glance"; - config = [ ( { polarity }: diff --git a/modules/gnome-text-editor/hm.nix b/modules/gnome-text-editor/hm.nix index c72ba084..32a007ec 100644 --- a/modules/gnome-text-editor/hm.nix +++ b/modules/gnome-text-editor/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "gnome-text-editor"; - humanName = "GNOME Text Editor"; - config = { dconf.settings."org/gnome/TextEditor".style-scheme = "stylix"; }; diff --git a/modules/gnome-text-editor/nixos.nix b/modules/gnome-text-editor/nixos.nix index 148b3cbd..22a0afa6 100644 --- a/modules/gnome-text-editor/nixos.nix +++ b/modules/gnome-text-editor/nixos.nix @@ -1,5 +1 @@ -{ mkTarget, ... }: -mkTarget { - name = "gnome-text-editor"; - humanName = "GNOME Text Editor"; -} +{ mkTarget, ... }: mkTarget { } diff --git a/modules/gnome/hm.nix b/modules/gnome/hm.nix index fe3cdf32..0e43b209 100644 --- a/modules/gnome/hm.nix +++ b/modules/gnome/hm.nix @@ -6,9 +6,6 @@ ... }: mkTarget { - name = "gnome"; - humanName = "GNOME"; - autoEnable = pkgs.stdenv.hostPlatform.isLinux; autoEnableExpr = "pkgs.stdenv.hostPlatform.isLinux"; diff --git a/modules/gtk/hm.nix b/modules/gtk/hm.nix index 88ebf8b6..e3eb283d 100644 --- a/modules/gtk/hm.nix +++ b/modules/gtk/hm.nix @@ -7,9 +7,6 @@ ... }: mkTarget { - name = "gtk"; - humanName = "all GTK3, GTK4 and Libadwaita apps"; - options = { extraCss = lib.mkOption { description = '' diff --git a/modules/gtk/nixos.nix b/modules/gtk/nixos.nix index 2300f90b..cb208716 100644 --- a/modules/gtk/nixos.nix +++ b/modules/gtk/nixos.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "gtk"; - humanName = "all GTK3, GTK4 and Libadwaita apps"; - config = { # Required for Home Manager's GTK settings to work programs.dconf.enable = true; diff --git a/modules/gtksourceview/hm.nix b/modules/gtksourceview/hm.nix index 00bd9e76..02bf853b 100644 --- a/modules/gtksourceview/hm.nix +++ b/modules/gtksourceview/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "gtksourceview"; - humanName = "GTKSourceView"; - config = { colors, ... }: { diff --git a/modules/gtksourceview/nixos.nix b/modules/gtksourceview/nixos.nix index e42e2d1c..40f8bd18 100644 --- a/modules/gtksourceview/nixos.nix +++ b/modules/gtksourceview/nixos.nix @@ -1,7 +1,3 @@ { mkTarget, ... }: -mkTarget { - name = "gtksourceview"; - humanName = "GTKSourceView"; - - # Used to enable overlay. -} +# Used to enable overlay. +mkTarget { } diff --git a/modules/halloy/hm.nix b/modules/halloy/hm.nix index b10f0727..fae67f7c 100644 --- a/modules/halloy/hm.nix +++ b/modules/halloy/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "halloy"; - humanName = "Halloy"; - config = { colors }: { diff --git a/modules/helix/hm.nix b/modules/helix/hm.nix index 1b4403bb..d7e37529 100644 --- a/modules/helix/hm.nix +++ b/modules/helix/hm.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "helix"; - humanName = "Helix"; - options.transparent = lib.mkEnableOption "transparent theming" // { internal = true; default = false; diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix index e15b7b29..1a7e1e00 100644 --- a/modules/hyprland/hm.nix +++ b/modules/hyprland/hm.nix @@ -5,8 +5,6 @@ ... }: mkTarget { - name = "hyprland"; - humanName = "Hyprland"; options = { image }: { diff --git a/modules/hyprlock/hm.nix b/modules/hyprlock/hm.nix index abd03139..74c54a9c 100644 --- a/modules/hyprlock/hm.nix +++ b/modules/hyprlock/hm.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "hyprlock"; - humanName = "Hyprlock"; - options.useWallpaper = config.lib.stylix.mkEnableWallpaper "Hyprlock" true; config = [ diff --git a/modules/hyprpanel/hm.nix b/modules/hyprpanel/hm.nix index fb44e9a5..8b3af480 100644 --- a/modules/hyprpanel/hm.nix +++ b/modules/hyprpanel/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "hyprpanel"; - humanName = "HyprPanel"; - config = [ ( { fonts }: diff --git a/modules/hyprpaper/hm.nix b/modules/hyprpaper/hm.nix index e230f0c5..6018b217 100644 --- a/modules/hyprpaper/hm.nix +++ b/modules/hyprpaper/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "hyprpaper"; - humanName = "Hyprpaper"; - config = { image }: { diff --git a/modules/i3/hm.nix b/modules/i3/hm.nix index 019b4177..192ecf96 100644 --- a/modules/i3/hm.nix +++ b/modules/i3/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "i3"; - humanName = "i3"; - options.exportedBarConfig = lib.mkOption { type = lib.types.attrs; default = { }; diff --git a/modules/i3bar-river/hm.nix b/modules/i3bar-river/hm.nix index 2bd22a0f..d72d3f1c 100644 --- a/modules/i3bar-river/hm.nix +++ b/modules/i3bar-river/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "i3bar-river"; - humanName = "i3bar-river"; - config = [ ( { fonts }: diff --git a/modules/jankyborders/darwin.nix b/modules/jankyborders/darwin.nix index e4948769..10cd9402 100644 --- a/modules/jankyborders/darwin.nix +++ b/modules/jankyborders/darwin.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "jankyborders"; - humanName = "JankyBorders"; - config = { colors, opacity }: { diff --git a/modules/k9s/hm.nix b/modules/k9s/hm.nix index f0a0bc26..5f31999a 100644 --- a/modules/k9s/hm.nix +++ b/modules/k9s/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "k9s"; - humanName = "k9s"; - config = { colors }: { diff --git a/modules/kitty/hm.nix b/modules/kitty/hm.nix index d17b5262..e7349475 100644 --- a/modules/kitty/hm.nix +++ b/modules/kitty/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "kitty"; - humanName = "Kitty"; - options = { variant256Colors = lib.mkOption { description = '' diff --git a/modules/kmscon/nixos.nix b/modules/kmscon/nixos.nix index 830e3828..03b52795 100644 --- a/modules/kmscon/nixos.nix +++ b/modules/kmscon/nixos.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "kmscon"; - humanName = "the kmscon virtual console"; - config = [ ( { fonts }: diff --git a/modules/kubecolor/hm.nix b/modules/kubecolor/hm.nix index 4b461f84..f0fe9bc8 100644 --- a/modules/kubecolor/hm.nix +++ b/modules/kubecolor/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "kubecolor"; - humanName = "kubecolor"; - config = [ ( { polarity }: diff --git a/modules/lazygit/hm.nix b/modules/lazygit/hm.nix index 50850ea4..570178f3 100644 --- a/modules/lazygit/hm.nix +++ b/modules/lazygit/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "lazygit"; - humanName = "lazygit"; - config = { colors }: { diff --git a/modules/lightdm/nixos.nix b/modules/lightdm/nixos.nix index b0720711..fe512f0f 100644 --- a/modules/lightdm/nixos.nix +++ b/modules/lightdm/nixos.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "lightdm"; - humanName = "LightDM"; - options.useWallpaper = config.lib.stylix.mkEnableWallpaper "LightDM" true; config = diff --git a/modules/limine/nixos.nix b/modules/limine/nixos.nix index 74b79071..0283c07a 100644 --- a/modules/limine/nixos.nix +++ b/modules/limine/nixos.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "limine"; - humanName = "Limine"; - options.useWallpaper = config.lib.stylix.mkEnableWallpaper "Limine" true; config = [ diff --git a/modules/mako/hm.nix b/modules/mako/hm.nix index 312fab72..e93621f1 100644 --- a/modules/mako/hm.nix +++ b/modules/mako/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "mako"; - humanName = "Mako"; - # Referenced https://github.com/stacyharper/base16-mako config = [ ( diff --git a/modules/mangohud/hm.nix b/modules/mangohud/hm.nix index f513f9e0..fdb6ba45 100644 --- a/modules/mangohud/hm.nix +++ b/modules/mangohud/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "mangohud"; - humanName = "mangohud"; - config = [ ( { fonts }: diff --git a/modules/micro/hm.nix b/modules/micro/hm.nix index a1a76db8..a234583c 100644 --- a/modules/micro/hm.nix +++ b/modules/micro/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "micro"; - humanName = "micro"; - config = { # TODO: Provide a real colorscheme once [1] is resolved. # diff --git a/modules/mpv/hm.nix b/modules/mpv/hm.nix index 1c0db2fe..9c66f375 100644 --- a/modules/mpv/hm.nix +++ b/modules/mpv/hm.nix @@ -1,7 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "mpv"; - humanName = "mpv"; config = [ ( { fonts }: diff --git a/modules/ncspot/hm.nix b/modules/ncspot/hm.nix index d03a9ec3..41e8d1eb 100644 --- a/modules/ncspot/hm.nix +++ b/modules/ncspot/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "ncspot"; - humanName = "Ncspot"; - options.background = lib.mkOption { type = lib.types.nullOr lib.types.str; description = "Used to set bg even if `opacity` or `colors` is null."; diff --git a/modules/nushell/hm.nix b/modules/nushell/hm.nix index 61a4b164..12b4b1fa 100644 --- a/modules/nushell/hm.nix +++ b/modules/nushell/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "nushell"; - humanName = "Nushell"; - # Adapted from https://www.nushell.sh/book/coloring_and_theming.html#theming config = { colors }: diff --git a/modules/obsidian/hm.nix b/modules/obsidian/hm.nix index 017b5a8f..9ed3ab15 100644 --- a/modules/obsidian/hm.nix +++ b/modules/obsidian/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "obsidian"; - humanName = "Obsidian"; - options.vaultNames = lib.mkOption { description = "The obsidian vault names to apply styling on."; type = lib.types.listOf lib.types.str; diff --git a/modules/opencode/hm.nix b/modules/opencode/hm.nix index edbd04d0..ce83cfe2 100644 --- a/modules/opencode/hm.nix +++ b/modules/opencode/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "opencode"; - humanName = "OpenCode"; - config = { colors }: { diff --git a/modules/plymouth/nixos.nix b/modules/plymouth/nixos.nix index 06cffbef..6dc3deb4 100644 --- a/modules/plymouth/nixos.nix +++ b/modules/plymouth/nixos.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "plymouth"; - humanName = "the Plymouth boot screen"; - options = { logo = lib.mkOption { description = "Logo to be used on the boot screen."; diff --git a/modules/qutebrowser/hm.nix b/modules/qutebrowser/hm.nix index 4996a1f5..2a3aae27 100644 --- a/modules/qutebrowser/hm.nix +++ b/modules/qutebrowser/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "qutebrowser"; - humanName = "Qutebrowser"; - config = [ ( { fonts }: diff --git a/modules/regreet/nixos.nix b/modules/regreet/nixos.nix index 81f66933..234294b4 100644 --- a/modules/regreet/nixos.nix +++ b/modules/regreet/nixos.nix @@ -6,9 +6,6 @@ ... }: mkTarget { - name = "regreet"; - humanName = "ReGreet"; - autoEnable = pkgs.stdenv.hostPlatform.isLinux; autoEnableExpr = "pkgs.stdenv.hostPlatform.isLinux"; diff --git a/modules/rio/hm.nix b/modules/rio/hm.nix index e518670c..073cf4e1 100644 --- a/modules/rio/hm.nix +++ b/modules/rio/hm.nix @@ -2,9 +2,6 @@ # - https://raphamorim.io/rio/docs/config { mkTarget, ... }: mkTarget { - name = "rio"; - humanName = "Rio"; - config = [ ( { fonts }: diff --git a/modules/rofi/hm.nix b/modules/rofi/hm.nix index fbb8ce0c..7ccd1fdc 100644 --- a/modules/rofi/hm.nix +++ b/modules/rofi/hm.nix @@ -1,8 +1,5 @@ { mkTarget, config, ... }: mkTarget { - name = "rofi"; - humanName = "Rofi"; - config = [ ( { fonts }: diff --git a/modules/spicetify/spicetify.nix b/modules/spicetify/spicetify.nix index c1af818c..6c22479d 100644 --- a/modules/spicetify/spicetify.nix +++ b/modules/spicetify/spicetify.nix @@ -6,9 +6,6 @@ ... }: mkTarget { - name = "spicetify"; - humanName = "Spicetify"; - config = { colors }: lib.optionalAttrs (options.programs ? spicetify) { diff --git a/modules/spotify-player/hm.nix b/modules/spotify-player/hm.nix index a3745fe2..5d09be62 100644 --- a/modules/spotify-player/hm.nix +++ b/modules/spotify-player/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "spotify-player"; - humanName = "spotify-player"; - config = { colors }: { diff --git a/modules/starship/hm.nix b/modules/starship/hm.nix index 44aa23b9..ae832927 100644 --- a/modules/starship/hm.nix +++ b/modules/starship/hm.nix @@ -1,9 +1,6 @@ # Starship configuration documentation: https://starship.rs/config { mkTarget, ... }: mkTarget { - name = "starship"; - humanName = "Starship"; - config = { colors }: { diff --git a/modules/swaylock/hm.nix b/modules/swaylock/hm.nix index 0e2219e2..ee0e3570 100644 --- a/modules/swaylock/hm.nix +++ b/modules/swaylock/hm.nix @@ -6,9 +6,6 @@ ... }: mkTarget { - name = "swaylock"; - humanName = "Swaylock"; - # When the state version is older than 23.05, Swaylock enables itself # automatically if `settings != {}` [1]. Therefore, Swaylock theming # shouldn't be enabled by default for such state versions, to avoid diff --git a/modules/swaync/hm.nix b/modules/swaync/hm.nix index 1670e287..9a4395a6 100644 --- a/modules/swaync/hm.nix +++ b/modules/swaync/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "swaync"; - humanName = "SwayNC"; - config = [ ( { fonts }: diff --git a/modules/sxiv/hm.nix b/modules/sxiv/hm.nix index ddd40e9f..d40dc9d9 100644 --- a/modules/sxiv/hm.nix +++ b/modules/sxiv/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "sxiv"; - humanName = "Sxiv"; - config = [ ( { fonts }: diff --git a/modules/tmux/hm.nix b/modules/tmux/hm.nix index 6d3c8538..8aae5500 100644 --- a/modules/tmux/hm.nix +++ b/modules/tmux/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "tmux"; - humanName = "Tmux"; - config = { colors, inputs }: { diff --git a/modules/tofi/hm.nix b/modules/tofi/hm.nix index a9b43ab0..7fc5b1b5 100644 --- a/modules/tofi/hm.nix +++ b/modules/tofi/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "tofi"; - humanName = "Tofi"; - config = [ ( { fonts }: diff --git a/modules/vicinae/hm.nix b/modules/vicinae/hm.nix index 53dab221..baaa0ac0 100644 --- a/modules/vicinae/hm.nix +++ b/modules/vicinae/hm.nix @@ -5,9 +5,6 @@ ... }: mkTarget { - name = "vicinae"; - humanName = "Vicinae"; - config = lib.optionals (options.services ? vicinae) [ ( { colors, polarity }: diff --git a/modules/vivid/hm.nix b/modules/vivid/hm.nix index 66de1086..c9172957 100644 --- a/modules/vivid/hm.nix +++ b/modules/vivid/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "vivid"; - humanName = "vivid"; - config = { colors }: let diff --git a/modules/vscode/hm.nix b/modules/vscode/hm.nix index c4d7d72f..04a4a955 100644 --- a/modules/vscode/hm.nix +++ b/modules/vscode/hm.nix @@ -6,9 +6,6 @@ ... }: mkTarget { - name = "vscode"; - humanName = "VSCode"; - options.profileNames = lib.mkOption { description = "The VSCode profile names to apply styling on."; type = lib.types.listOf lib.types.str; diff --git a/modules/waybar/hm.nix b/modules/waybar/hm.nix index e0be29d2..4ad22dfa 100644 --- a/modules/waybar/hm.nix +++ b/modules/waybar/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "waybar"; - humanName = "Waybar"; - options = { background = lib.mkOption { type = lib.types.nullOr lib.types.str; diff --git a/modules/wayfire/hm.nix b/modules/wayfire/hm.nix index b3723ea3..d090e89d 100644 --- a/modules/wayfire/hm.nix +++ b/modules/wayfire/hm.nix @@ -6,9 +6,6 @@ ... }: mkTarget { - name = "wayfire"; - humanName = "Wayfire"; - options.useWallpaper = config.lib.stylix.mkEnableWallpaper "wayfire" true; config = [ diff --git a/modules/wayprompt/hm.nix b/modules/wayprompt/hm.nix index b88bc3f8..6f88c9cf 100644 --- a/modules/wayprompt/hm.nix +++ b/modules/wayprompt/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "wayprompt"; - humanName = "Wayprompt"; - config = { colors, opacity }: let diff --git a/modules/wezterm/hm.nix b/modules/wezterm/hm.nix index 92d08410..12d14f84 100644 --- a/modules/wezterm/hm.nix +++ b/modules/wezterm/hm.nix @@ -5,8 +5,6 @@ ... }: mkTarget { - name = "wezterm"; - humanName = "WezTerm"; options.luaBody = lib.mkOption { type = lib.types.lines; default = ""; diff --git a/modules/wob/hm.nix b/modules/wob/hm.nix index d7b5f29d..383affaf 100644 --- a/modules/wob/hm.nix +++ b/modules/wob/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "wob"; - humanName = "wob"; - config = { colors }: { diff --git a/modules/wofi/hm.nix b/modules/wofi/hm.nix index eb816d59..5bb41e1d 100644 --- a/modules/wofi/hm.nix +++ b/modules/wofi/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "wofi"; - humanName = "wofi"; - config = [ ( { fonts }: diff --git a/modules/wpaperd/hm.nix b/modules/wpaperd/hm.nix index 23fbefb9..35cd1e21 100644 --- a/modules/wpaperd/hm.nix +++ b/modules/wpaperd/hm.nix @@ -1,8 +1,5 @@ { mkTarget, lib, ... }: mkTarget { - name = "wpaperd"; - humanName = "wpaperd"; - config = { imageScalingMode, image }: ( diff --git a/modules/xfce/hm.nix b/modules/xfce/hm.nix index f258d7ea..01573694 100644 --- a/modules/xfce/hm.nix +++ b/modules/xfce/hm.nix @@ -1,7 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "xfce"; - humanName = "Xfce"; # Disabled by default due to https://github.com/nix-community/stylix/issues/180 autoEnable = false; diff --git a/modules/xresources/hm.nix b/modules/xresources/hm.nix index 826e1ce0..a9a5929b 100644 --- a/modules/xresources/hm.nix +++ b/modules/xresources/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "xresources"; - humanName = "Xresources"; - config = [ ( { fonts }: diff --git a/modules/yazi/hm.nix b/modules/yazi/hm.nix index c028b45f..b00eb4fb 100644 --- a/modules/yazi/hm.nix +++ b/modules/yazi/hm.nix @@ -1,9 +1,6 @@ # Based on the official catppuccin themes https://github.com/yazi-rs/themes { mkTarget, lib, ... }: mkTarget { - name = "yazi"; - humanName = "Yazi"; - options.boldDirectory = lib.mkOption { description = "Whether to use bold font for directories."; type = lib.types.bool; diff --git a/modules/zathura/hm.nix b/modules/zathura/hm.nix index 08c30af8..0feb61d7 100644 --- a/modules/zathura/hm.nix +++ b/modules/zathura/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "zathura"; - humanName = "Zathura"; - config = { colors, opacity }: { diff --git a/modules/zed/hm.nix b/modules/zed/hm.nix index 6e030866..b7300c1a 100644 --- a/modules/zed/hm.nix +++ b/modules/zed/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "zed"; - humanName = "zed"; - config = [ ( { fonts }: diff --git a/modules/zellij/hm.nix b/modules/zellij/hm.nix index bca443d9..2142b68d 100644 --- a/modules/zellij/hm.nix +++ b/modules/zellij/hm.nix @@ -1,8 +1,5 @@ { mkTarget, ... }: mkTarget { - name = "zellij"; - humanName = "zellij"; - config = { colors }: { diff --git a/modules/zen-browser/hm.nix b/modules/zen-browser/hm.nix index 44d97cce..cf2d1d76 100644 --- a/modules/zen-browser/hm.nix +++ b/modules/zen-browser/hm.nix @@ -6,9 +6,6 @@ ... }: mkTarget { - name = "zen-browser"; - humanName = "Zen Browser"; - options = { profileNames = lib.mkOption { description = "The Zen Browser profile names to apply styling on."; diff --git a/stylix/autoload.nix b/stylix/autoload.nix index 86babf57..3eeaf2f4 100644 --- a/stylix/autoload.nix +++ b/stylix/autoload.nix @@ -1,7 +1,10 @@ -{ lib }: +{ lib, pkgs }: # string -> [ path ] # List include path for either nixos modules or hm modules platform: +let + meta = import ./meta.nix { inherit lib pkgs; }; +in builtins.concatLists ( lib.mapAttrsToList ( target: kind: @@ -15,7 +18,10 @@ builtins.concatLists ( # NOTE: `mkTarget` cannot be distributed normally through the module system # due to issues of infinite recursion. - mkTarget = import ./mk-target.nix; + mkTarget = import ./mk-target.nix { + humanName = meta.${target}.name; + name = target; + }; in lib.optional (kind == "directory" && builtins.pathExists file) ( if useMkTarget then diff --git a/stylix/darwin/default.nix b/stylix/darwin/default.nix index bafe2bda..7e61dd00 100644 --- a/stylix/darwin/default.nix +++ b/stylix/darwin/default.nix @@ -1,6 +1,11 @@ -{ lib, config, ... }: +{ + lib, + pkgs, + config, + ... +}: let - autoload = import ../autoload.nix { inherit lib; } "darwin"; + autoload = import ../autoload.nix { inherit lib pkgs; } "darwin"; in { imports = [ diff --git a/stylix/droid/default.nix b/stylix/droid/default.nix index e23d7cfe..0394fc14 100644 --- a/stylix/droid/default.nix +++ b/stylix/droid/default.nix @@ -1,6 +1,6 @@ -{ lib, ... }: +{ lib, pkgs, ... }: let - autoload = import ../autoload.nix { inherit lib; } "droid"; + autoload = import ../autoload.nix { inherit lib pkgs; } "droid"; in { imports = [ diff --git a/stylix/hm/default.nix b/stylix/hm/default.nix index 8c533047..7aacf5a1 100644 --- a/stylix/hm/default.nix +++ b/stylix/hm/default.nix @@ -1,6 +1,11 @@ -{ lib, config, ... }: +{ + lib, + pkgs, + config, + ... +}: let - autoload = import ../autoload.nix { inherit lib; } "hm"; + autoload = import ../autoload.nix { inherit lib pkgs; } "hm"; in { imports = [ diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index f987c3d9..e5cf805f 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -19,9 +19,6 @@ ```nix { mkTarget, lib... }: mkTarget { - name = "«name»"; - humanName = "«human readable name»"; - unconditionalConfig = lib.mkIf complexCondition { home.packages = [ pkgs.hello ]; @@ -51,15 +48,7 @@ `config` (Attribute set) - : `name` (String) - : The target name used to generate options in the `stylix.targets.${name}` - namespace. - - `humanName` (String) - : The descriptive target name passed to the lib.mkEnableOption function - when generating the `stylix.targets.${name}.enable` option. - - `autoEnable` (Boolean) + : `autoEnable` (Boolean) : Whether the target should be automatically enabled by default according to the `stylix.autoEnable` option. @@ -115,6 +104,10 @@ automatically by `mkEnableTargetWith` and depends on `autoEnable` and whether an `autoEnableExpr` is used. + `humanName` (String) + : The descriptive target name passed to the lib.mkEnableOption function + when generating the `stylix.targets.${name}.enable` option. +   `imports` (List)   : The `imports` option forwarded to the Nixpkgs module system. @@ -128,6 +121,10 @@ { extension.enable = lib.mkEnableOption "the bloated dependency"; } ``` + `name` (String) + : The target name used to generate options in the `stylix.targets.${name}` + namespace. + `unconditionalConfig` (Attribute set or function or path) : This argument mirrors the `config` argument but intentionally lacks automatic safeguarding and should only be used for complex configurations @@ -146,9 +143,6 @@ # of modules: # # { -# name = "example"; -# humanName = "Example Target"; -# # unconditionalConfig = # { lib, pkgs }: # lib.mkIf complexCondition { @@ -173,15 +167,20 @@ # ) # ]; # } +{ humanName, name }: +let + humanName' = humanName; + name' = name; +in { - name, - humanName, autoEnable ? null, autoEnableExpr ? null, autoWrapEnableExpr ? null, config ? [ ], enableExample ? null, + humanName ? humanName', imports ? [ ], + name ? name', options ? { }, unconditionalConfig ? { }, }@args: diff --git a/stylix/nixos/default.nix b/stylix/nixos/default.nix index 431383f8..beced139 100644 --- a/stylix/nixos/default.nix +++ b/stylix/nixos/default.nix @@ -1,6 +1,11 @@ -{ lib, config, ... }: +{ + lib, + pkgs, + config, + ... +}: let - autoload = import ../autoload.nix { inherit lib; } "nixos"; + autoload = import ../autoload.nix { inherit lib pkgs; } "nixos"; in { imports = [ diff --git a/stylix/overlays.nix b/stylix/overlays.nix index 0d8f76e3..a6fdc6ea 100644 --- a/stylix/overlays.nix +++ b/stylix/overlays.nix @@ -32,5 +32,5 @@ attrs.overlay ]; } - ) (import ./autoload.nix { inherit lib; } "overlay"); + ) (import ./autoload.nix { inherit lib pkgs; } "overlay"); } From 953c3fb01e2a2cbfef092309852ba19d5ae6ee34 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 11:28:37 +0200 Subject: [PATCH 09/10] stylix/mk-target: generate options for configuring safeguarded arguments Generate targets.${target}.${argument}.enable and targets.${target}.${argument}.override options for disabling and configuring safeguarded arguments on a target level. --- stylix/mk-target.nix | 141 ++++++++++++++++++++++++++++++++----------- 1 file changed, 105 insertions(+), 36 deletions(-) diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index e5cf805f..aec99ba9 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -193,38 +193,11 @@ let callModule = let areArgumentsEnabled = lib.flip lib.pipe [ - builtins.attrValues - (builtins.all (argument: argument.enable or (argument != null))) + lib.attrsToList + (builtins.all ( + { name, value }: value.enable or (value != null) && cfg.${name}.enable or true + )) ]; - - getArguments = - function: - lib.genAttrs - (lib.pipe function [ - lib.functionArgs - builtins.attrNames - ]) - ( - argument: - if argument == "cfg" then - cfg - - else if argument == "colors" then - config.lib.stylix.colors - - else - config.stylix.${argument} or (throw "stylix: mkTarget expected one of ${ - lib.concatMapStringsSep ", " (expected: "`${expected}`") ( - lib.naturalSort ( - [ - "cfg" - "colors" - ] - ++ builtins.attrNames config.stylix - ) - ) - }, but got: ${argument}") - ); in safeguard: config': let @@ -240,7 +213,7 @@ let config' else if builtins.isPath config' then - callModule safeguard (import config') + throw "stylix: unexpected unresolved path: ${toString config'}" else throw "stylix: mkTarget expected a configuration to be a function, an attribute set, or a path, but got ${builtins.typeOf config'}: ${ @@ -248,11 +221,107 @@ let }"; cfg = config.stylix.targets.${name}; + + getArguments = + function: + lib.genAttrs + (lib.pipe function [ + lib.functionArgs + builtins.attrNames + ]) + ( + argument: + if argument == "cfg" then + cfg + + else + ( + config': + let + inherit (cfg.${argument}) override; + in + if override == null then + config' + else if builtins.typeOf override != builtins.typeOf config' then + throw "stylix: expected `config.stylix.targets.${name}.${argument}.override` to be a ${builtins.typeOf config'}, but got: ${builtins.typeOf override}" + else if builtins.isAttrs override then + lib.recursiveUpdate config' override + else + override + ) + ( + if argument == "colors" then + config.lib.stylix.colors + + else + config.stylix.${argument} or (throw "stylix: mkTarget expected one of ${ + lib.concatMapStringsSep ", " (expected: "`${expected}`") ( + lib.naturalSort ( + [ + "cfg" + "colors" + ] + ++ builtins.attrNames config.stylix + ) + ) + }, but got: ${argument}") + ) + ); + + normalizeConfig = + config: + map (lib.fix ( + self: config': + if builtins.isPath config' then self (import config') else config' + )) (lib.toList config); + + normalizedConfig = normalizeConfig mkTargetConfig; in { - imports = imports ++ [ - { options.stylix.targets.${name} = callModule false options; } - ]; + imports = + lib.singleton { + options.stylix.targets.${name} = + lib.genAttrs + (lib.concatLists ( + map (lib.flip lib.pipe [ + ( + config': lib.optionalAttrs (builtins.isFunction config') (getArguments config') + ) + builtins.attrNames + (lib.remove "cfg") + ]) (normalizedConfig ++ normalizeConfig options) + )) + ( + argument: + let + config = "`${ + if argument == "colors" then + "config.lib.stylix.colors" + else + "config.stylix.${argument}" + }`"; + in + { + enable = lib.mkEnableOption "${config} for ${humanName}" // { + default = true; + example = false; + }; + + override = lib.mkOption { + default = null; + + description = '' + Attribute sets are recursively merged with ${config}, + while all other non-`null` types override ${config}. + ''; + + type = lib.types.anything; + }; + } + ); + } + ++ imports + ++ lib.singleton { options.stylix.targets.${name} = callModule false options; }; options.stylix.targets.${name}.enable = let @@ -271,7 +340,7 @@ let config = lib.mkIf (config.stylix.enable && cfg.enable) ( lib.mkMerge ( lib.singleton (callModule false unconditionalConfig) - ++ map (callModule true) (lib.toList mkTargetConfig) + ++ map (callModule true) normalizedConfig ) ); }; From 6153df31ce4f68f5709755994cc49c48d737e98c Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sat, 19 Jul 2025 18:40:26 +0200 Subject: [PATCH 10/10] stylix/mk-target: normalize options argument identically to config Normalize the options argument identically to config to provide a coherent and extensible options interface. --- stylix/mk-target.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index aec99ba9..bf1e02e3 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -111,9 +111,9 @@   `imports` (List)   : The `imports` option forwarded to the Nixpkgs module system. - `options` (Attribute set) - : Additional options to be added in the `stylix.targets.${name}` namespace - along the `stylix.targets.${name}.enable` option. + `options` (List or attribute set or function or path) + : Additional options to be added in the `stylix.targets.${name}` namespace, + normalized identically to `config`. For example, an extension guard used in the configuration can be declared as follows: @@ -181,7 +181,7 @@ in humanName ? humanName', imports ? [ ], name ? name', - options ? { }, + options ? [ ], unconditionalConfig ? { }, }@args: let @@ -276,6 +276,7 @@ let )) (lib.toList config); normalizedConfig = normalizeConfig mkTargetConfig; + normalizedOptions = normalizeConfig options; in { imports = @@ -289,7 +290,7 @@ let ) builtins.attrNames (lib.remove "cfg") - ]) (normalizedConfig ++ normalizeConfig options) + ]) (normalizedConfig ++ normalizedOptions) )) ( argument: @@ -321,7 +322,9 @@ let ); } ++ imports - ++ lib.singleton { options.stylix.targets.${name} = callModule false options; }; + ++ map (option: { + options.stylix.targets.${name} = callModule false option; + }) normalizedOptions; options.stylix.targets.${name}.enable = let