Merge palette option into main Catppuccin home module config

This commit is contained in:
Jo 2025-05-14 08:25:10 +02:00
parent 2f5395dc64
commit 01b1273012

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
self, self,
pkgs,
config, config,
osConfig, osConfig,
namespace, namespace,
@ -9,12 +10,15 @@
inherit (lib) mkEnableOption types mkIf; inherit (lib) mkEnableOption types mkIf;
inherit (self.lib) mkOpt; inherit (self.lib) mkOpt;
palette = (pkgs.lib.importJSON (config.catppuccin.sources.palette + "/palette.json")).${config.catppuccin.flavor}.colors;
cfg = config.${namespace}.themes.catppuccin; cfg = config.${namespace}.themes.catppuccin;
in { in {
options.${namespace}.themes.catppuccin = { options.${namespace}.themes.catppuccin = {
enable = mkEnableOption "the Catppuccin theme, globally."; enable = mkEnableOption "the Catppuccin theme, globally.";
accent = mkOpt types.str "blue" "The accent colour to use."; accent = mkOpt types.str "blue" "The accent colour to use.";
flavor = mkOpt types.str "macchiato" "The flavor to use."; flavor = mkOpt types.str "macchiato" "The flavor to use.";
palette = mkOpt (lib.types.attrsOf lib.types.raw) palette "a reference to the current active Catppuccin palette.";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -28,6 +32,8 @@ in {
cursors.flavor = cfg.flavor; cursors.flavor = cfg.flavor;
}; };
${namespace}.themes.catppuccin.gtk.enable = mkIf osConfig.${namespace}.desktop.gnome.enable true; ${namespace}.themes.catppuccin = {
gtk.enable = mkIf osConfig.${namespace}.desktop.gnome.enable true;
};
}; };
} }