diff --git a/modules/blender/Stylix.xml.mustache b/modules/blender/Stylix.xml.mustache deleted file mode 100644 index c44b33ea..00000000 --- a/modules/blender/Stylix.xml.mustache +++ /dev/null @@ -1,1532 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/blender/color-theme.nix b/modules/blender/color-theme.nix new file mode 100644 index 00000000..65a8628e --- /dev/null +++ b/modules/blender/color-theme.nix @@ -0,0 +1,1501 @@ +{ colors }: +with colors; +{ + stylix.targets.blender.themeBody = '' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ''; +} diff --git a/modules/blender/font-theme.nix b/modules/blender/font-theme.nix new file mode 100644 index 00000000..50096e8e --- /dev/null +++ b/modules/blender/font-theme.nix @@ -0,0 +1,40 @@ +{ fonts }: +{ + stylix.targets.blender.themeBody = '' + + + + + + + + + + + + ''; +} diff --git a/modules/blender/hm.nix b/modules/blender/hm.nix index f11ab796..a3e79934 100644 --- a/modules/blender/hm.nix +++ b/modules/blender/hm.nix @@ -1,46 +1,52 @@ { - config, + mkTarget, lib, - pkgs, ... }: -{ - options.stylix.targets.blender.enable = - config.lib.stylix.mkEnableTarget "blender" true; +mkTarget { + name = "blender"; + humanName = "Blender"; - config = - lib.mkIf (config.stylix.enable && config.stylix.targets.blender.enable) + extraOptions.themeBody = lib.mkOption { + type = lib.types.lines; + default = ""; + internal = true; + }; + + configElements = [ + ./color-theme.nix + ./font-theme.nix + ( + { cfg }: { xdg.configFile = let - theme = pkgs.writeText "Stylix.replaced.xml.mustache" ( - builtins.replaceStrings - [ "%POPUPSFONTSIZE%" "%DESKTOPFONTSIZE%" ] - [ - (toString config.stylix.fonts.sizes.popups) - (toString config.stylix.fonts.sizes.desktop) - ] - (builtins.readFile ./Stylix.xml.mustache) - ); + indent = + string: " " + lib.concatStringsSep "\n " (lib.splitString "\n" string); in - builtins.listToAttrs ( - map - ( - version: - lib.nameValuePair - "blender/${version}/scripts/presets/interface_theme/Stylix.xml" - { - source = config.lib.stylix.colors { - template = theme; - extension = ".xml"; - }; - } - ) - [ - "4.2" - "4.3" - "4.4" - ] + lib.mkIf (cfg.themeBody != "") ( + builtins.listToAttrs ( + map + ( + version: + lib.nameValuePair + "blender/${version}/scripts/presets/interface_theme/Stylix.xml" + { + text = lib.concatLines [ + "" + (indent cfg.themeBody) + "" + ]; + } + ) + [ + "4.2" + "4.3" + "4.4" + ] + ) ); - }; + } + ) + ]; }