diff --git a/modules/bemenu/hm.nix b/modules/bemenu/hm.nix index 38fb913c..68f1653d 100644 --- a/modules/bemenu/hm.nix +++ b/modules/bemenu/hm.nix @@ -1,31 +1,28 @@ -{ - mkTarget, - lib, - config, - ... -}: +{ mkTarget, lib, ... }: mkTarget { name = "bemenu"; humanName = "bemenu"; - extraOptions = { - fontSize = lib.mkOption { - description = '' - Font size used for bemenu. - ''; - type = with lib.types; nullOr int; - default = config.stylix.fonts.sizes.popups; - defaultText = lib.literalExpression "config.stylix.fonts.sizes.popups"; - }; # optional argument + extraOptions = + { fonts }: + { + fontSize = lib.mkOption { + description = '' + Font size used for bemenu. + ''; + type = with lib.types; nullOr int; + default = fonts.sizes.popups; + defaultText = lib.literalExpression "config.stylix.fonts.sizes.popups"; + }; # optional argument - alternate = lib.mkOption { - description = '' - Whether to use alternating colours. - ''; - type = lib.types.bool; - default = false; + alternate = lib.mkOption { + description = '' + Whether to use alternating colours. + ''; + type = lib.types.bool; + default = false; + }; }; - }; configElements = [ ( diff --git a/modules/hyprland/hm.nix b/modules/hyprland/hm.nix index a7c624ce..119ba797 100644 --- a/modules/hyprland/hm.nix +++ b/modules/hyprland/hm.nix @@ -7,11 +7,16 @@ mkTarget { name = "hyprland"; humanName = "Hyprland"; - extraOptions.hyprpaper.enable = config.lib.stylix.mkEnableTargetWith { - name = "Hyprpaper"; - autoEnable = config.stylix.image != null; - autoEnableExpr = "config.stylix.image != null"; - }; + extraOptions = + { image }: + { + hyprpaper.enable = config.lib.stylix.mkEnableTargetWith { + name = "Hyprpaper"; + autoEnable = image != null; + autoEnableExpr = "config.stylix.image != null"; + }; + }; + configElements = [ ( { colors }: diff --git a/stylix/autoload.nix b/stylix/autoload.nix index 34782fbd..16df30f9 100644 --- a/stylix/autoload.nix +++ b/stylix/autoload.nix @@ -42,7 +42,19 @@ builtins.concatLists ( { key = file; _file = file; - imports = [ (module (args // extraArgs // { inherit mkTarget; })) ]; + imports = [ + (module ( + args + // extraArgs + // { + inherit mkTarget; + config = lib.recursiveUpdate config { + stylix = throw "stylix: unguareded `config.stylix` accessed while using mkTarget"; + lib.stylix.colors = throw "stylix: unguareded `config.lib.stylix.colors` accessed while using mkTarget"; + }; + } + )) + ]; } else file diff --git a/stylix/mk-target.nix b/stylix/mk-target.nix index 64697cb8..d2d868c8 100644 --- a/stylix/mk-target.nix +++ b/stylix/mk-target.nix @@ -241,7 +241,9 @@ let c; in { - inherit imports; + imports = imports ++ [ + { options.stylix.targets.${name} = mkConfig (lib.toFunction extraOptions); } + ]; options.stylix.targets.${name}.enable = let @@ -273,8 +275,5 @@ let }; in { - imports = [ - { options.stylix.targets.${name} = extraOptions; } - module - ]; + imports = [ module ]; }