chore(modules): use attrset as argument to mkCatppuccinOpt (#252)

This commit is contained in:
seth 2024-06-28 16:29:30 +00:00 committed by GitHub
parent eaab21cb0b
commit 3f4607481b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 68 additions and 57 deletions

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.alacritty.enable; enable = cfg.enable && config.programs.alacritty.enable;
in in
{ {
options.programs.alacritty.catppuccin = lib.ctp.mkCatppuccinOpt "alacritty"; options.programs.alacritty.catppuccin = lib.ctp.mkCatppuccinOpt { name = "alacritty"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.alacritty.settings = lib.importTOML "${sources.alacritty}/catppuccin-${cfg.flavor}.toml"; programs.alacritty.settings = lib.importTOML "${sources.alacritty}/catppuccin-${cfg.flavor}.toml";

View file

@ -6,7 +6,7 @@ let
themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavor}"; themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavor}";
in in
{ {
options.programs.bat.catppuccin = lib.ctp.mkCatppuccinOpt "bat"; options.programs.bat.catppuccin = lib.ctp.mkCatppuccinOpt { name = "bat"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.bat = { programs.bat = {

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.bottom.enable; enable = cfg.enable && config.programs.bottom.enable;
in in
{ {
options.programs.bottom.catppuccin = lib.ctp.mkCatppuccinOpt "bottom"; options.programs.bottom.catppuccin = lib.ctp.mkCatppuccinOpt { name = "bottom"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.bottom = { programs.bottom = {

View file

@ -9,7 +9,7 @@ let
theme = sources.btop + themePath; theme = sources.btop + themePath;
in in
{ {
options.programs.btop.catppuccin = lib.ctp.mkCatppuccinOpt "btop"; options.programs.btop.catppuccin = lib.ctp.mkCatppuccinOpt { name = "btop"; };
config = lib.mkIf enable { config = lib.mkIf enable {
xdg.configFile."btop${themePath}".source = theme; xdg.configFile."btop${themePath}".source = theme;

View file

@ -6,7 +6,7 @@ let
flavor = "${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent"; flavor = "${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent";
in in
{ {
options.programs.cava.catppuccin = lib.ctp.mkCatppuccinOpt "cava" // { options.programs.cava.catppuccin = lib.ctp.mkCatppuccinOpt { name = "cava"; } // {
transparent = lib.mkEnableOption "transparent version of flavor"; transparent = lib.mkEnableOption "transparent version of flavor";
}; };

View file

@ -17,7 +17,7 @@ let
); );
in in
{ {
options.catppuccin.pointerCursor = ctp.mkCatppuccinOpt "cursors" // { options.catppuccin.pointerCursor = ctp.mkCatppuccinOpt { name = "pointer cursors"; } // {
accent = ctp.mkBasicOpt "accent" cursorAccentType "cursors"; accent = ctp.mkBasicOpt "accent" cursorAccentType "cursors";
}; };

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.git.delta.enable; enable = cfg.enable && config.programs.git.delta.enable;
in in
{ {
options.programs.git.delta.catppuccin = lib.ctp.mkCatppuccinOpt "catppuccin"; options.programs.git.delta.catppuccin = lib.ctp.mkCatppuccinOpt { name = "delta"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.git = { programs.git = {

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.services.dunst.enable; enable = cfg.enable && config.services.dunst.enable;
in in
{ {
options.services.dunst.catppuccin = lib.ctp.mkCatppuccinOpt "dunst"; options.services.dunst.catppuccin = lib.ctp.mkCatppuccinOpt { name = "dunst"; };
config.services.dunst = lib.mkIf enable { config.services.dunst = lib.mkIf enable {
settings = lib.ctp.fromINI (sources.dunst + "/themes/${cfg.flavor}.conf"); settings = lib.ctp.fromINI (sources.dunst + "/themes/${cfg.flavor}.conf");

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5";
in in
{ {
options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt "Fcitx5" // { options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt { name = "Fcitx5"; } // {
apply = lib.mkOption { apply = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;

View file

@ -8,7 +8,7 @@ let
themePath = "/themes/${themeName}.theme"; themePath = "/themes/${themeName}.theme";
in in
{ {
options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish"; options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt { name = "fish"; };
config = lib.mkIf enable { config = lib.mkIf enable {
xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}"; xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}";

View file

@ -7,7 +7,7 @@ let
theme = lib.ctp.fromINI (sources.foot + "/themes/catppuccin-${cfg.flavor}.ini"); theme = lib.ctp.fromINI (sources.foot + "/themes/catppuccin-${cfg.flavor}.ini");
in in
{ {
options.programs.foot.catppuccin = lib.ctp.mkCatppuccinOpt "foot"; options.programs.foot.catppuccin = lib.ctp.mkCatppuccinOpt { name = "foot"; };
config.programs.foot = lib.mkIf enable { settings = theme; }; config.programs.foot = lib.mkIf enable { settings = theme; };
} }

View file

@ -7,7 +7,7 @@ let
palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors;
in in
{ {
options.programs.fzf.catppuccin = lib.ctp.mkCatppuccinOpt "fzf"; options.programs.fzf.catppuccin = lib.ctp.mkCatppuccinOpt { name = "fzf"; };
config.programs.fzf.colors = config.programs.fzf.colors =
lib.mkIf enable lib.mkIf enable

View file

@ -6,7 +6,7 @@ let
theme = "${sources.gh-dash}/themes/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml"; theme = "${sources.gh-dash}/themes/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml";
in in
{ {
options.programs.gh-dash.catppuccin = lib.ctp.mkCatppuccinOpt "gh-dash" // { options.programs.gh-dash.catppuccin = lib.ctp.mkCatppuccinOpt { name = "gh-dash"; } // {
accent = lib.ctp.mkAccentOpt "gh-dash"; accent = lib.ctp.mkAccentOpt "gh-dash";
}; };

View file

@ -6,7 +6,7 @@ let
enable = cfg.enable && config.programs.gitui.enable; enable = cfg.enable && config.programs.gitui.enable;
in in
{ {
options.programs.gitui.catppuccin = lib.ctp.mkCatppuccinOpt "gitui"; options.programs.gitui.catppuccin = lib.ctp.mkCatppuccinOpt { name = "gitui"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.gitui.theme = builtins.path { programs.gitui.theme = builtins.path {

View file

@ -5,7 +5,7 @@ let
inherit (cfg) enable; inherit (cfg) enable;
in in
{ {
options.programs.glamour.catppuccin = lib.ctp.mkCatppuccinOpt "glamour"; options.programs.glamour.catppuccin = lib.ctp.mkCatppuccinOpt { name = "glamour"; };
config = { config = {
home.sessionVariables = lib.mkIf enable { home.sessionVariables = lib.mkIf enable {

View file

@ -19,7 +19,7 @@ let
enable = cfg.enable && config.gtk.enable; enable = cfg.enable && config.gtk.enable;
in in
{ {
options.gtk.catppuccin = ctp.mkCatppuccinOpt "gtk" // { options.gtk.catppuccin = ctp.mkCatppuccinOpt { name = "gtk"; } // {
# NOTE: we are overriding the previous declaration of `enable` here # NOTE: we are overriding the previous declaration of `enable` here
# as this module is deprecated and we do not want it to apply with # as this module is deprecated and we do not want it to apply with
# the global `catppuccin.enable` # the global `catppuccin.enable`
@ -48,8 +48,8 @@ in
gnomeShellTheme = mkEnableOption "Catppuccin gtk theme for GNOME Shell"; gnomeShellTheme = mkEnableOption "Catppuccin gtk theme for GNOME Shell";
icon = ctp.mkCatppuccinOpt "gtk modified Papirus icon theme" // { icon = ctp.mkCatppuccinOpt { name = "GTK modified Papirus icon theme"; } // {
accent = ctp.mkAccentOpt "gtk modified Papirus icon theme"; accent = ctp.mkAccentOpt "GTK modified Papirus icon theme";
}; };
}; };

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.helix.enable; enable = cfg.enable && config.programs.helix.enable;
in in
{ {
options.programs.helix.catppuccin = lib.ctp.mkCatppuccinOpt "helix" // { options.programs.helix.catppuccin = lib.ctp.mkCatppuccinOpt { name = "helix"; } // {
useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix"; useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix";
}; };

View file

@ -6,9 +6,11 @@ let
inherit (config.catppuccin) pointerCursor; inherit (config.catppuccin) pointerCursor;
in in
{ {
options.wayland.windowManager.hyprland.catppuccin = lib.ctp.mkCatppuccinOpt "hyprland" // { options.wayland.windowManager.hyprland.catppuccin =
accent = lib.ctp.mkAccentOpt "hyprland"; lib.ctp.mkCatppuccinOpt { name = "hyprland"; }
}; // {
accent = lib.ctp.mkAccentOpt "hyprland";
};
config = lib.mkIf enable { config = lib.mkIf enable {
home.sessionVariables = lib.mkIf pointerCursor.enable { home.sessionVariables = lib.mkIf pointerCursor.enable {

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.imv.enable; enable = cfg.enable && config.programs.imv.enable;
in in
{ {
options.programs.imv.catppuccin = lib.ctp.mkCatppuccinOpt "imv"; options.programs.imv.catppuccin = lib.ctp.mkCatppuccinOpt { name = "imv"; };
config.programs.imv.settings = lib.mkIf enable ( config.programs.imv.settings = lib.mkIf enable (
lib.ctp.fromINI (sources.imv + "/themes/${cfg.flavor}.config") lib.ctp.fromINI (sources.imv + "/themes/${cfg.flavor}.config")

View file

@ -11,7 +11,7 @@ let
theme = sources.k9s + "/dist/${themeFile}"; theme = sources.k9s + "/dist/${themeFile}";
in in
{ {
options.programs.k9s.catppuccin = lib.ctp.mkCatppuccinOpt "k9s" // { options.programs.k9s.catppuccin = lib.ctp.mkCatppuccinOpt { name = "k9s"; } // {
transparent = lib.mkEnableOption "transparent version of flavor"; transparent = lib.mkEnableOption "transparent version of flavor";
}; };

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.kitty.enable; enable = cfg.enable && config.programs.kitty.enable;
in in
{ {
options.programs.kitty.catppuccin = ctp.mkCatppuccinOpt "kitty"; options.programs.kitty.catppuccin = ctp.mkCatppuccinOpt { name = "kitty"; };
config.programs.kitty = lib.mkIf enable { theme = "Catppuccin-${ctp.mkUpper cfg.flavor}"; }; config.programs.kitty = lib.mkIf enable { theme = "Catppuccin-${ctp.mkUpper cfg.flavor}"; };
} }

View file

@ -17,7 +17,7 @@ let
themeName = "Catppuccin-${flavorCapitalized}-${accentCapitalized}"; themeName = "Catppuccin-${flavorCapitalized}-${accentCapitalized}";
in in
{ {
options.qt.style.catppuccin = lib.ctp.mkCatppuccinOpt "Kvantum" // { options.qt.style.catppuccin = lib.ctp.mkCatppuccinOpt { name = "Kvantum"; } // {
accent = lib.ctp.mkAccentOpt "Kvantum"; accent = lib.ctp.mkAccentOpt "Kvantum";
apply = lib.mkOption { apply = lib.mkOption {

View file

@ -8,7 +8,7 @@ let
themePath = "${cfg.flavor}/${cfg.accent}.yml"; themePath = "${cfg.flavor}/${cfg.accent}.yml";
in in
{ {
options.programs.lazygit.catppuccin = lib.ctp.mkCatppuccinOpt "lazygit" // { options.programs.lazygit.catppuccin = lib.ctp.mkCatppuccinOpt { name = "lazygit"; } // {
accent = ctp.mkAccentOpt "lazygit"; accent = ctp.mkAccentOpt "lazygit";
}; };

View file

@ -14,7 +14,7 @@ let
extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme; extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme;
in in
{ {
options.services.mako.catppuccin = lib.ctp.mkCatppuccinOpt "mako"; options.services.mako.catppuccin = lib.ctp.mkCatppuccinOpt { name = "mako"; };
# Will cause infinite recursion if config.services.mako is directly set as a whole # Will cause infinite recursion if config.services.mako is directly set as a whole
config.services.mako = lib.mkIf enable { config.services.mako = lib.mkIf enable {

View file

@ -7,7 +7,7 @@ let
themePath = "catppuccin-${cfg.flavor}.micro"; themePath = "catppuccin-${cfg.flavor}.micro";
in in
{ {
options.programs.micro.catppuccin = lib.ctp.mkCatppuccinOpt "micro"; options.programs.micro.catppuccin = lib.ctp.mkCatppuccinOpt { name = "micro"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath; programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath;

View file

@ -6,7 +6,7 @@ let
themeDir = sources.mpv + "/themes/${cfg.flavor}/${cfg.accent}"; themeDir = sources.mpv + "/themes/${cfg.flavor}/${cfg.accent}";
in in
{ {
options.programs.mpv.catppuccin = lib.ctp.mkCatppuccinOpt "mpv" // { options.programs.mpv.catppuccin = lib.ctp.mkCatppuccinOpt { name = "mpv"; } // {
accent = lib.ctp.mkAccentOpt "mpv"; accent = lib.ctp.mkAccentOpt "mpv";
}; };

View file

@ -9,7 +9,7 @@ let
enable = cfg.enable && config.programs.neovim.enable; enable = cfg.enable && config.programs.neovim.enable;
in in
{ {
options.programs.neovim.catppuccin = lib.ctp.mkCatppuccinOpt "neovim"; options.programs.neovim.catppuccin = lib.ctp.mkCatppuccinOpt { name = "neovim"; };
config.programs.neovim = lib.mkIf enable { config.programs.neovim = lib.mkIf enable {
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [

View file

@ -7,7 +7,7 @@ let
theme = if cfg.flavor == "latte" then "latte" else "dark"; theme = if cfg.flavor == "latte" then "latte" else "dark";
in in
{ {
options.programs.newsboat.catppuccin = lib.ctp.mkCatppuccinOpt "newsboat"; options.programs.newsboat.catppuccin = lib.ctp.mkCatppuccinOpt { name = "newsboat"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.newsboat.extraConfig = builtins.readFile "${sources.newsboat}/themes/${theme}"; programs.newsboat.extraConfig = builtins.readFile "${sources.newsboat}/themes/${theme}";

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.services.polybar.enable; enable = cfg.enable && config.services.polybar.enable;
in in
{ {
options.services.polybar.catppuccin = lib.ctp.mkCatppuccinOpt "polybar"; options.services.polybar.catppuccin = lib.ctp.mkCatppuccinOpt { name = "polybar"; };
config.services.polybar.extraConfig = lib.mkIf enable ( config.services.polybar.extraConfig = lib.mkIf enable (
builtins.readFile "${sources.polybar}/themes/${cfg.flavor}.ini" builtins.readFile "${sources.polybar}/themes/${cfg.flavor}.ini"

View file

@ -7,7 +7,7 @@ let
enable = cfg.enable && config.programs.rio.enable; enable = cfg.enable && config.programs.rio.enable;
in in
{ {
options.programs.rio.catppuccin = ctp.mkCatppuccinOpt "rio"; options.programs.rio.catppuccin = ctp.mkCatppuccinOpt { name = "rio"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.rio.settings = lib.importTOML "${sources.rio}/themes/catppuccin-${cfg.flavor}.toml"; programs.rio.settings = lib.importTOML "${sources.rio}/themes/catppuccin-${cfg.flavor}.toml";

View file

@ -6,7 +6,7 @@ let
enable = cfg.enable && config.programs.rofi.enable; enable = cfg.enable && config.programs.rofi.enable;
in in
{ {
options.programs.rofi.catppuccin = lib.ctp.mkCatppuccinOpt "rofi"; options.programs.rofi.catppuccin = lib.ctp.mkCatppuccinOpt { name = "rofi"; };
config.programs.rofi = lib.mkIf enable { config.programs.rofi = lib.mkIf enable {
theme = { theme = {

View file

@ -6,7 +6,7 @@ let
palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors;
in in
{ {
options.programs.skim.catppuccin = lib.ctp.mkCatppuccinOpt "skim"; options.programs.skim.catppuccin = lib.ctp.mkCatppuccinOpt { name = "skim"; };
config.programs.skim = lib.mkIf enable { config.programs.skim = lib.mkIf enable {
defaultOptions = [ defaultOptions = [

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.starship.enable; enable = cfg.enable && config.programs.starship.enable;
in in
{ {
options.programs.starship.catppuccin = lib.ctp.mkCatppuccinOpt "starship"; options.programs.starship.catppuccin = lib.ctp.mkCatppuccinOpt { name = "starship"; };
config.programs.starship.settings = lib.mkIf enable ( config.programs.starship.settings = lib.mkIf enable (
{ {

View file

@ -6,7 +6,7 @@ let
theme = "${sources.sway}/themes/catppuccin-${cfg.flavor}"; theme = "${sources.sway}/themes/catppuccin-${cfg.flavor}";
in in
{ {
options.wayland.windowManager.sway.catppuccin = lib.ctp.mkCatppuccinOpt "sway"; options.wayland.windowManager.sway.catppuccin = lib.ctp.mkCatppuccinOpt { name = "sway"; };
config = lib.mkIf enable { config = lib.mkIf enable {
wayland.windowManager.sway.extraConfigEarly = '' wayland.windowManager.sway.extraConfigEarly = ''

View file

@ -24,7 +24,7 @@ let
}; };
in in
{ {
options.programs.tmux.catppuccin = ctp.mkCatppuccinOpt "tmux" // { options.programs.tmux.catppuccin = ctp.mkCatppuccinOpt { name = "tmux"; } // {
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
description = "Additional configuration for the catppuccin plugin."; description = "Additional configuration for the catppuccin plugin.";

View file

@ -5,7 +5,7 @@ let
enable = cfg.enable && config.programs.tofi.enable; enable = cfg.enable && config.programs.tofi.enable;
in in
{ {
options.programs.tofi.catppuccin = lib.ctp.mkCatppuccinOpt "tofi"; options.programs.tofi.catppuccin = lib.ctp.mkCatppuccinOpt { name = "tofi"; };
config.programs.tofi = lib.mkIf enable { config.programs.tofi = lib.mkIf enable {
settings = lib.ctp.fromINI (sources.tofi + "/themes/catppuccin-${cfg.flavor}"); settings = lib.ctp.fromINI (sources.tofi + "/themes/catppuccin-${cfg.flavor}");

View file

@ -6,7 +6,7 @@ let
styleFile = "${sources.waybar}/themes/${cfg.flavor}.css"; styleFile = "${sources.waybar}/themes/${cfg.flavor}.css";
in in
{ {
options.programs.waybar.catppuccin = (lib.ctp.mkCatppuccinOpt "waybar") // { options.programs.waybar.catppuccin = lib.ctp.mkCatppuccinOpt { name = "waybar"; } // {
mode = lib.mkOption { mode = lib.mkOption {
type = lib.types.enum [ type = lib.types.enum [
"prependImport" "prependImport"

View file

@ -6,7 +6,7 @@ let
enable = cfg.enable && config.programs.yazi.enable; enable = cfg.enable && config.programs.yazi.enable;
in in
{ {
options.programs.yazi.catppuccin = lib.ctp.mkCatppuccinOpt "yazi"; options.programs.yazi.catppuccin = lib.ctp.mkCatppuccinOpt { name = "yazi"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.yazi.theme = lib.importTOML "${sources.yazi}/themes/${cfg.flavor}.toml"; programs.yazi.theme = lib.importTOML "${sources.yazi}/themes/${cfg.flavor}.toml";

View file

@ -11,7 +11,7 @@ let
themeFile = sources.zathura + "/src/catppuccin-${cfg.flavor}"; themeFile = sources.zathura + "/src/catppuccin-${cfg.flavor}";
in in
{ {
options.programs.zathura.catppuccin = lib.ctp.mkCatppuccinOpt "zathura"; options.programs.zathura.catppuccin = lib.ctp.mkCatppuccinOpt { name = "zathura"; };
config.programs.zathura.options = lib.mkIf enable ( config.programs.zathura.options = lib.mkIf enable (
lib.ctp.fromINI ( lib.ctp.fromINI (

View file

@ -5,7 +5,7 @@ let
themeName = "catppuccin-${cfg.flavor}"; themeName = "catppuccin-${cfg.flavor}";
in in
{ {
options.programs.zellij.catppuccin = lib.ctp.mkCatppuccinOpt "zellij"; options.programs.zellij.catppuccin = lib.ctp.mkCatppuccinOpt { name = "zellij"; };
config = lib.mkIf enable { config = lib.mkIf enable {
programs.zellij.settings = { programs.zellij.settings = {

View file

@ -6,7 +6,9 @@ let
enable = cfg.enable && config.programs.zsh.syntaxHighlighting.enable; enable = cfg.enable && config.programs.zsh.syntaxHighlighting.enable;
in in
{ {
options.programs.zsh.syntaxHighlighting.catppuccin = ctp.mkCatppuccinOpt "zsh syntax highlighting"; options.programs.zsh.syntaxHighlighting.catppuccin = ctp.mkCatppuccinOpt {
name = "Zsh Syntax Highlighting";
};
config.programs.zsh = lib.mkIf enable { config.programs.zsh = lib.mkIf enable {
initExtra = lib.mkBefore '' initExtra = lib.mkBefore ''

View file

@ -107,15 +107,22 @@ in
# string -> a # string -> a
# this creates a basic attrset only containing an # this creates a basic attrset only containing an
# enable and flavor option. the fist string should # enable and flavor option. `name` should be the name
# be the name of the module, followed by the local config # of the module, while `enableDefault` is a boolean
# attrset # representing the default of the created `enable`
mkCatppuccinOpt = name: { # option
enable = lib.mkEnableOption "Catppuccin theme" // { mkCatppuccinOpt =
default = config.catppuccin.enable; {
name,
enableDefault ? config.catppuccin.enable,
}:
{
enable = lib.mkEnableOption "Catppuccin theme for ${name}" // {
default = enableDefault;
};
flavor = ctp.mkFlavorOpt name;
}; };
flavor = ctp.mkFlavorOpt name;
};
# string -> a # string -> a
# this creates an accent option for modules # this creates an accent option for modules

View file

@ -6,7 +6,7 @@ let
palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors;
in in
{ {
options.console.catppuccin = lib.ctp.mkCatppuccinOpt "console"; options.console.catppuccin = lib.ctp.mkCatppuccinOpt { name = "console"; };
config.console.colors = lib.mkIf enable ( config.console.colors = lib.mkIf enable (
# Manually populate with colors from catppuccin/tty # Manually populate with colors from catppuccin/tty

View file

@ -16,7 +16,7 @@ let
''; '';
in in
{ {
options.boot.loader.grub.catppuccin = lib.ctp.mkCatppuccinOpt "grub"; options.boot.loader.grub.catppuccin = lib.ctp.mkCatppuccinOpt { name = "grub"; };
config.boot.loader.grub = lib.mkIf enable { config.boot.loader.grub = lib.mkIf enable {
font = "${theme}/font.pf2"; font = "${theme}/font.pf2";

View file

@ -10,7 +10,7 @@ let
enable = cfg.enable && config.boot.plymouth.enable; enable = cfg.enable && config.boot.plymouth.enable;
in in
{ {
options.boot.plymouth.catppuccin = ctp.mkCatppuccinOpt "plymouth"; options.boot.plymouth.catppuccin = ctp.mkCatppuccinOpt { name = "plymouth"; };
config.boot.plymouth = mkIf enable { config.boot.plymouth = mkIf enable {
theme = "catppuccin-${cfg.flavor}"; theme = "catppuccin-${cfg.flavor}";

View file

@ -16,7 +16,7 @@ let
in in
{ {
options.services.displayManager.sddm.catppuccin = ctp.mkCatppuccinOpt "sddm" // { options.services.displayManager.sddm.catppuccin = ctp.mkCatppuccinOpt { name = "sddm"; } // {
font = mkOption { font = mkOption {
type = types.str; type = types.str;
default = "Noto Sans"; default = "Noto Sans";