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] 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