From bfd08e220a6c6c343471b410df8adfe4bb9adb60 Mon Sep 17 00:00:00 2001 From: isabel Date: Sun, 10 Nov 2024 11:21:40 +0000 Subject: [PATCH] feat: move to catppuccin namespace Co-authored-by: Weathercold Co-authored-by: seth --- modules/home-manager/aerc.nix | 13 ++- modules/home-manager/alacritty.nix | 13 ++- modules/home-manager/all-modules.nix | 4 +- modules/home-manager/bat.nix | 13 ++- modules/home-manager/bottom.nix | 13 ++- modules/home-manager/btop.nix | 13 ++- modules/home-manager/cava.nix | 29 ++++- .../home-manager/{cursor.nix => cursors.nix} | 13 ++- modules/home-manager/delta.nix | 14 ++- modules/home-manager/dunst.nix | 29 ++++- modules/home-manager/fcitx5.nix | 32 +++++- modules/home-manager/fish.nix | 13 ++- modules/home-manager/foot.nix | 13 ++- modules/home-manager/freetube.nix | 30 ++++- modules/home-manager/fuzzel.nix | 14 ++- modules/home-manager/fzf.nix | 14 ++- modules/home-manager/gh-dash.nix | 14 ++- modules/home-manager/gitui.nix | 13 ++- modules/home-manager/glamour.nix | 13 ++- modules/home-manager/gtk.nix | 106 +++++++++++------- modules/home-manager/helix.nix | 29 ++++- modules/home-manager/hyprland.nix | 27 +++-- modules/home-manager/hyprlock.nix | 14 ++- modules/home-manager/imv.nix | 13 ++- modules/home-manager/k9s.nix | 29 ++++- modules/home-manager/kitty.nix | 13 ++- modules/home-manager/kvantum.nix | 30 ++++- modules/home-manager/lazygit.nix | 14 ++- modules/home-manager/mako.nix | 14 ++- modules/home-manager/micro.nix | 13 ++- modules/home-manager/mpv.nix | 14 ++- modules/home-manager/neovim.nix | 13 ++- modules/home-manager/newsboat.nix | 13 ++- .../home-manager/{obs-studio.nix => obs.nix} | 13 ++- modules/home-manager/polybar.nix | 13 ++- modules/home-manager/rio.nix | 13 ++- modules/home-manager/rofi.nix | 13 ++- modules/home-manager/skim.nix | 13 ++- modules/home-manager/spotify-player.nix | 13 ++- modules/home-manager/starship.nix | 13 ++- modules/home-manager/sway.nix | 14 ++- modules/home-manager/swaylock.nix | 13 ++- modules/home-manager/tmux.nix | 29 ++++- modules/home-manager/tofi.nix | 13 ++- modules/home-manager/waybar.nix | 29 ++++- modules/home-manager/yazi.nix | 14 ++- modules/home-manager/zathura.nix | 13 ++- modules/home-manager/zellij.nix | 13 ++- .../home-manager/zsh-syntax-highlighting.nix | 42 +++++-- modules/lib/default.nix | 52 +++++++++ modules/nixos/all-modules.nix | 2 +- modules/nixos/fcitx5.nix | 15 ++- modules/nixos/grub.nix | 14 ++- modules/nixos/plymouth.nix | 13 ++- modules/nixos/sddm.nix | 92 ++++++++++++++- modules/nixos/{console.nix => tty.nix} | 12 +- 56 files changed, 963 insertions(+), 160 deletions(-) rename modules/home-manager/{cursor.nix => cursors.nix} (77%) rename modules/home-manager/{obs-studio.nix => obs.nix} (63%) rename modules/nixos/{console.nix => tty.nix} (74%) diff --git a/modules/home-manager/aerc.nix b/modules/home-manager/aerc.nix index 4e90e279..bc181489 100644 --- a/modules/home-manager/aerc.nix +++ b/modules/home-manager/aerc.nix @@ -1,12 +1,21 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.aerc.catppuccin; + cfg = config.catppuccin.aerc; enable = cfg.enable && config.programs.aerc.enable; themeName = "catppuccin-${cfg.flavor}"; in { - options.programs.aerc.catppuccin = lib.ctp.mkCatppuccinOpt { name = "aerc"; }; + options.catppuccin.aerc = lib.ctp.mkCatppuccinOpt { name = "aerc"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "aerc" + "catppuccin" + ]; + to = "aerc"; + }; config = lib.mkIf enable { programs.aerc = { diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 5e019f34..505d6492 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.alacritty.catppuccin; + cfg = config.catppuccin.alacritty; enable = cfg.enable && config.programs.alacritty.enable; in { - options.programs.alacritty.catppuccin = lib.ctp.mkCatppuccinOpt { name = "alacritty"; }; + options.catppuccin.alacritty = lib.ctp.mkCatppuccinOpt { name = "alacritty"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "alacritty" + "catppuccin" + ]; + to = "alacritty"; + }; config = lib.mkIf enable { programs.alacritty.settings = lib.importTOML "${sources.alacritty}/catppuccin-${cfg.flavor}.toml"; diff --git a/modules/home-manager/all-modules.nix b/modules/home-manager/all-modules.nix index b151e841..b2d51194 100644 --- a/modules/home-manager/all-modules.nix +++ b/modules/home-manager/all-modules.nix @@ -5,7 +5,7 @@ ./bottom.nix ./btop.nix ./cava.nix - ./cursor.nix + ./cursors.nix ./delta.nix ./dunst.nix ./fcitx5.nix @@ -42,7 +42,7 @@ ./sway.nix ./tmux.nix ./tofi.nix - ./obs-studio.nix + ./obs.nix ./waybar.nix ./yazi.nix ./zathura.nix diff --git a/modules/home-manager/bat.nix b/modules/home-manager/bat.nix index d8b42590..d27ee5ff 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -1,12 +1,21 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.bat.catppuccin; + cfg = config.catppuccin.bat; enable = cfg.enable && config.programs.bat.enable; themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavor}"; in { - options.programs.bat.catppuccin = lib.ctp.mkCatppuccinOpt { name = "bat"; }; + options.catppuccin.bat = lib.ctp.mkCatppuccinOpt { name = "bat"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "bat" + "catppuccin" + ]; + to = "bat"; + }; config = lib.mkIf enable { programs.bat = { diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index 69ba2fa3..453d19e4 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.bottom.catppuccin; + cfg = config.catppuccin.bottom; enable = cfg.enable && config.programs.bottom.enable; in { - options.programs.bottom.catppuccin = lib.ctp.mkCatppuccinOpt { name = "bottom"; }; + options.catppuccin.bottom = lib.ctp.mkCatppuccinOpt { name = "bottom"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "bottom" + "catppuccin" + ]; + to = "bottom"; + }; config = lib.mkIf enable { programs.bottom = { diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index d14a8442..731b8cc5 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -1,7 +1,7 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.btop.catppuccin; + cfg = config.catppuccin.btop; enable = cfg.enable && config.programs.btop.enable; themeFile = "catppuccin_${cfg.flavor}.theme"; @@ -9,7 +9,16 @@ let theme = sources.btop + themePath; in { - options.programs.btop.catppuccin = lib.ctp.mkCatppuccinOpt { name = "btop"; }; + options.catppuccin.btop = lib.ctp.mkCatppuccinOpt { name = "btop"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "btop" + "catppuccin" + ]; + to = "btop"; + }; config = lib.mkIf enable { xdg.configFile."btop${themePath}".source = theme; diff --git a/modules/home-manager/cava.nix b/modules/home-manager/cava.nix index 80d63fe8..5c1db2b7 100644 --- a/modules/home-manager/cava.nix +++ b/modules/home-manager/cava.nix @@ -1,15 +1,40 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.cava.catppuccin; + cfg = config.catppuccin.cava; enable = cfg.enable && config.programs.cava.enable; flavor = "${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent"; in { - options.programs.cava.catppuccin = lib.ctp.mkCatppuccinOpt { name = "cava"; } // { + options.catppuccin.cava = lib.ctp.mkCatppuccinOpt { name = "cava"; } // { transparent = lib.mkEnableOption "transparent version of flavor"; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "cava" + "catppuccin" + ]; + to = "cava"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "cava" + "catppuccin" + "transparent" + ] + [ + "catppuccin" + "cava" + "transparent" + ] + ) + ]; + config.programs.cava = lib.mkIf enable { settings = lib.ctp.fromINIRaw (sources.cava + "/themes/${flavor}.cava"); }; diff --git a/modules/home-manager/cursor.nix b/modules/home-manager/cursors.nix similarity index 77% rename from modules/home-manager/cursor.nix rename to modules/home-manager/cursors.nix index b96470e9..ed4c09a3 100644 --- a/modules/home-manager/cursor.nix +++ b/modules/home-manager/cursors.nix @@ -6,7 +6,7 @@ }: let inherit (lib) ctp mkIf; - cfg = config.catppuccin.pointerCursor; + cfg = config.catppuccin.cursors; # "dark" and "light" can be used alongside the regular accents cursorAccentType = ctp.mergeEnums ctp.types.accentOption ( @@ -17,7 +17,7 @@ let ); in { - options.catppuccin.pointerCursor = + options.catppuccin.cursors = ctp.mkCatppuccinOpt { name = "pointer cursors"; # NOTE: we exclude this from the global `catppuccin.enable` as there is no @@ -28,6 +28,15 @@ in accent = ctp.mkBasicOpt "accent" cursorAccentType "cursors"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "catppuccin" + "pointerCursor" + ]; + to = "cursors"; + accentSupport = true; + }; + config.home.pointerCursor = mkIf cfg.enable { name = "catppuccin-${cfg.flavor}-${cfg.accent}-cursors"; package = pkgs.catppuccin-cursors.${cfg.flavor + ctp.mkUpper cfg.accent}; diff --git a/modules/home-manager/delta.nix b/modules/home-manager/delta.nix index 72c814d0..88a21a31 100644 --- a/modules/home-manager/delta.nix +++ b/modules/home-manager/delta.nix @@ -1,11 +1,21 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.git.delta.catppuccin; + cfg = config.catppuccin.delta; enable = cfg.enable && config.programs.git.delta.enable; in { - options.programs.git.delta.catppuccin = lib.ctp.mkCatppuccinOpt { name = "delta"; }; + options.catppuccin.delta = lib.ctp.mkCatppuccinOpt { name = "delta"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "git" + "delta" + "catppuccin" + ]; + to = "delta"; + }; config = lib.mkIf enable { programs.git = { diff --git a/modules/home-manager/dunst.nix b/modules/home-manager/dunst.nix index 07a5dfc0..62dd0358 100644 --- a/modules/home-manager/dunst.nix +++ b/modules/home-manager/dunst.nix @@ -1,11 +1,11 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.services.dunst.catppuccin; + cfg = config.catppuccin.dunst; enable = cfg.enable && config.services.dunst.enable; in { - options.services.dunst.catppuccin = lib.ctp.mkCatppuccinOpt { name = "dunst"; } // { + options.catppuccin.dunst = lib.ctp.mkCatppuccinOpt { name = "dunst"; } // { prefix = lib.mkOption { type = lib.types.str; default = "00"; @@ -13,6 +13,31 @@ in }; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "services" + "dunst" + "catppuccin" + ]; + to = "dunst"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "services" + "dunst" + "catppuccin" + "prefix" + ] + [ + "catppuccin" + "dunst" + "prefix" + ] + ) + ]; + # Dunst currently has no "include" functionality, but has "drop-ins" # Unfortunately, this may cause inconvenience as it overrides ~/.config/dunst/dunstrc # but it can be overridden by another drop-in. diff --git a/modules/home-manager/fcitx5.nix b/modules/home-manager/fcitx5.nix index bd11c27b..9f5b133d 100644 --- a/modules/home-manager/fcitx5.nix +++ b/modules/home-manager/fcitx5.nix @@ -1,11 +1,11 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.i18n.inputMethod.fcitx5.catppuccin; + cfg = config.catppuccin.fcitx5; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; in { - options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt { name = "Fcitx5"; } // { + options.catppuccin.fcitx5 = lib.ctp.mkCatppuccinOpt { name = "Fcitx5"; } // { accent = lib.ctp.mkAccentOpt "Fcitx5"; apply = lib.mkOption { type = lib.types.bool; @@ -17,6 +17,34 @@ in }; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "i18n" + "inputMethod" + "fcitx5" + "catppuccin" + ]; + to = "fcitx5"; + accentSupport = true; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "i18n" + "inputMethod" + "fcitx5" + "catppuccin" + "apply" + ] + [ + "catppuccin" + "fcitx5" + "apply" + ] + ) + ]; + config = lib.mkIf enable { xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavor}-${cfg.accent}" = { source = "${sources.fcitx5}/src/catppuccin-${cfg.flavor}-${cfg.accent}"; diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index e32ee3d4..cacec61f 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -1,14 +1,23 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.fish.catppuccin; + cfg = config.catppuccin.fish; enable = cfg.enable && config.programs.fish.enable; themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavor}"; themePath = "/themes/${themeName}.theme"; in { - options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt { name = "fish"; }; + options.catppuccin.fish = lib.ctp.mkCatppuccinOpt { name = "fish"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "fish" + "catppuccin" + ]; + to = "fish"; + }; config = lib.mkIf enable { xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}"; diff --git a/modules/home-manager/foot.nix b/modules/home-manager/foot.nix index ac7afa93..ffe297b4 100644 --- a/modules/home-manager/foot.nix +++ b/modules/home-manager/foot.nix @@ -2,11 +2,20 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.foot.catppuccin; + cfg = config.catppuccin.foot; enable = cfg.enable && config.programs.foot.enable; in { - options.programs.foot.catppuccin = lib.ctp.mkCatppuccinOpt { name = "foot"; }; + options.catppuccin.foot = lib.ctp.mkCatppuccinOpt { name = "foot"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "foot" + "catppuccin" + ]; + to = "foot"; + }; config.programs.foot = lib.mkIf enable { settings.main.include = sources.foot + "/themes/catppuccin-${cfg.flavor}.ini"; diff --git a/modules/home-manager/freetube.nix b/modules/home-manager/freetube.nix index 704dc1f4..2259206a 100644 --- a/modules/home-manager/freetube.nix +++ b/modules/home-manager/freetube.nix @@ -2,11 +2,11 @@ let inherit (config.programs.freetube.settings) baseTheme; inherit (lib.ctp) mkAccentOpt mkUpper; - cfg = config.programs.freetube.catppuccin; + cfg = config.catppuccin.freetube; enable = cfg.enable && config.programs.freetube.enable; in { - options.programs.freetube.catppuccin = lib.ctp.mkCatppuccinOpt { name = "freetube"; } // { + options.catppuccin.freetube = lib.ctp.mkCatppuccinOpt { name = "freetube"; } // { accent = mkAccentOpt "FreeTube"; # FreeTube supports two accent colors secondaryAccent = mkAccentOpt "FreeTube" // { @@ -16,6 +16,32 @@ in }; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "freetube" + "catppuccin" + ]; + to = "freetube"; + accentSupport = true; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "freetube" + "catppuccin" + "secondaryAccent" + ] + [ + "catppuccin" + "freetube" + "secondaryAccent" + ] + ) + ]; + config.programs.freetube.settings = lib.mkIf enable { # NOTE: For some reason, baseTheme does not capitalize first letter, but the other settings do baseTheme = "catppuccin${mkUpper cfg.flavor}"; diff --git a/modules/home-manager/fuzzel.nix b/modules/home-manager/fuzzel.nix index f902cd3b..0e79277e 100644 --- a/modules/home-manager/fuzzel.nix +++ b/modules/home-manager/fuzzel.nix @@ -1,13 +1,23 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.fuzzel.catppuccin; + cfg = config.catppuccin.fuzzel; in { - options.programs.fuzzel.catppuccin = lib.ctp.mkCatppuccinOpt { name = "fuzzel"; } // { + options.catppuccin.fuzzel = lib.ctp.mkCatppuccinOpt { name = "fuzzel"; } // { accent = lib.ctp.mkAccentOpt "fuzzel"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "fuzzel" + "catppuccin" + ]; + to = "fuzzel"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { programs.fuzzel.settings.main.include = sources.fuzzel + "/themes/catppuccin-${cfg.flavor}/${cfg.accent}.ini"; diff --git a/modules/home-manager/fzf.nix b/modules/home-manager/fzf.nix index 7d9b87ab..6814dc70 100644 --- a/modules/home-manager/fzf.nix +++ b/modules/home-manager/fzf.nix @@ -2,15 +2,25 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.fzf.catppuccin; + cfg = config.catppuccin.fzf; enable = cfg.enable && config.programs.fzf.enable; palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; in { - options.programs.fzf.catppuccin = lib.ctp.mkCatppuccinOpt { name = "fzf"; } // { + options.catppuccin.fzf = lib.ctp.mkCatppuccinOpt { name = "fzf"; } // { accent = lib.ctp.mkAccentOpt "fzf"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "fzf" + "catppuccin" + ]; + to = "fzf"; + accentSupport = true; + }; + config.programs.fzf.colors = lib.mkIf enable # Manually populate with colors from catppuccin/fzf diff --git a/modules/home-manager/gh-dash.nix b/modules/home-manager/gh-dash.nix index 85118ad2..7331acb8 100644 --- a/modules/home-manager/gh-dash.nix +++ b/modules/home-manager/gh-dash.nix @@ -1,14 +1,24 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.gh-dash.catppuccin; + cfg = config.catppuccin.gh-dash; enable = cfg.enable && config.programs.gh-dash.enable; theme = "${sources.gh-dash}/themes/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml"; in { - options.programs.gh-dash.catppuccin = lib.ctp.mkCatppuccinOpt { name = "gh-dash"; } // { + options.catppuccin.gh-dash = lib.ctp.mkCatppuccinOpt { name = "gh-dash"; } // { accent = lib.ctp.mkAccentOpt "gh-dash"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "gh-dash" + "catppuccin" + ]; + to = "gh-dash"; + accentSupport = true; + }; + config.programs.gh-dash.settings = lib.mkIf enable (lib.ctp.fromYaml theme); } diff --git a/modules/home-manager/gitui.nix b/modules/home-manager/gitui.nix index 43b4def0..25f02547 100644 --- a/modules/home-manager/gitui.nix +++ b/modules/home-manager/gitui.nix @@ -2,11 +2,20 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.gitui.catppuccin; + cfg = config.catppuccin.gitui; enable = cfg.enable && config.programs.gitui.enable; in { - options.programs.gitui.catppuccin = lib.ctp.mkCatppuccinOpt { name = "gitui"; }; + options.catppuccin.gitui = lib.ctp.mkCatppuccinOpt { name = "gitui"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "gitui" + "catppuccin" + ]; + to = "gitui"; + }; config = lib.mkIf enable { programs.gitui.theme = builtins.path { diff --git a/modules/home-manager/glamour.nix b/modules/home-manager/glamour.nix index 5b9e4d2c..9096f6a6 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.glamour.catppuccin; + cfg = config.catppuccin.glamour; inherit (cfg) enable; in { - options.programs.glamour.catppuccin = lib.ctp.mkCatppuccinOpt { name = "glamour"; }; + options.catppuccin.glamour = lib.ctp.mkCatppuccinOpt { name = "glamour"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "glamour" + "catppuccin" + ]; + to = "glamour"; + }; config = { home.sessionVariables = lib.mkIf enable { diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index d026b30d..9a7cf00b 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -15,11 +15,11 @@ let mkRenamedOptionModule types ; - cfg = config.gtk.catppuccin; + cfg = config.catppuccin.gtk; enable = cfg.enable && config.gtk.enable; in { - options.gtk.catppuccin = + options.catppuccin.gtk = ctp.mkCatppuccinOpt { name = "gtk"; enableDefault = false; @@ -63,49 +63,77 @@ in }; }; - imports = [ - (mkRenamedOptionModule - [ + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ "gtk" "catppuccin" - "cursor" - "enable" - ] - [ - "catppuccin" - "pointerCursor" - "enable" - ] - ) - - (mkRenamedOptionModule - [ + ]; + to = "gtk"; + accentSupport = true; + }) + ++ (lib.ctp.mkRenamedCatppuccinOpts { + from = [ "gtk" "catppuccin" "cursor" - "flavor" - ] - [ - "catppuccin" - "pointerCursor" - "flavor" - ] - ) + ]; + to = "cursors"; + accentSupport = true; + }) + ++ [ + (mkRenamedOptionModule + [ + "gtk" + "catppuccin" + "size" + ] + [ + "catppuccin" + "gtk" + "size" + ] + ) - (mkRenamedOptionModule - [ - "gtk" - "catppuccin" - "cursor" - "accent" - ] - [ - "catppuccin" - "pointerCursor" - "accent" - ] - ) - ]; + (mkRenamedOptionModule + [ + "gtk" + "catppuccin" + "tweaks" + ] + [ + "catppuccin" + "gtk" + "tweaks" + ] + ) + + (mkRenamedOptionModule + [ + "gtk" + "catppuccin" + "gnomeShellTheme" + ] + [ + "catppuccin" + "gtk" + "gnomeShellTheme" + ] + ) + + (mkRenamedOptionModule + [ + "gtk" + "catppuccin" + "icon" + ] + [ + "catppuccin" + "gtk" + "icon" + ] + ) + ]; config = mkMerge [ (mkIf (enable || cfg.gnomeShellTheme) { diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 4b3b55c7..3afe9b32 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -1,14 +1,39 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.helix.catppuccin; + cfg = config.catppuccin.helix; enable = cfg.enable && config.programs.helix.enable; in { - options.programs.helix.catppuccin = lib.ctp.mkCatppuccinOpt { name = "helix"; } // { + options.catppuccin.helix = lib.ctp.mkCatppuccinOpt { name = "helix"; } // { useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix"; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "helix" + "catppuccin" + ]; + to = "helix"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "helix" + "catppuccin" + "useItalics" + ] + [ + "catppuccin" + "helix" + "useItalics" + ] + ) + ]; + config = lib.mkIf enable { programs.helix = let diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index fb3351f7..a2db6e39 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -1,20 +1,29 @@ { config, lib, ... }: let - inherit (config.catppuccin) sources pointerCursor; - cfg = config.wayland.windowManager.hyprland.catppuccin; + inherit (config.catppuccin) sources cursors; + cfg = config.catppuccin.hyprland; enable = cfg.enable && config.wayland.windowManager.hyprland.enable; in { - options.wayland.windowManager.hyprland.catppuccin = - lib.ctp.mkCatppuccinOpt { name = "hyprland"; } - // { - accent = lib.ctp.mkAccentOpt "hyprland"; - }; + options.catppuccin.hyprland = lib.ctp.mkCatppuccinOpt { name = "hyprland"; } // { + accent = lib.ctp.mkAccentOpt "hyprland"; + }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "wayland" + "windowManager" + "hyprland" + "catppuccin" + ]; + to = "hyprland"; + accentSupport = true; + }; config = lib.mkIf enable { - home.sessionVariables = lib.mkIf pointerCursor.enable { + home.sessionVariables = lib.mkIf cursors.enable { HYPRCURSOR_SIZE = config.home.pointerCursor.size; - HYPRCURSOR_THEME = "catppuccin-${pointerCursor.flavor}-${pointerCursor.accent}-cursors"; + HYPRCURSOR_THEME = "catppuccin-${cursors.flavor}-${cursors.accent}-cursors"; }; wayland.windowManager.hyprland.settings = { diff --git a/modules/home-manager/hyprlock.nix b/modules/home-manager/hyprlock.nix index 37ca432f..bfc17d6b 100644 --- a/modules/home-manager/hyprlock.nix +++ b/modules/home-manager/hyprlock.nix @@ -1,14 +1,24 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.hyprlock.catppuccin; + cfg = config.catppuccin.hyprlock; enable = cfg.enable && config.programs.hyprlock.enable; in { - options.programs.hyprlock.catppuccin = lib.ctp.mkCatppuccinOpt { name = "hyprlock"; } // { + options.catppuccin.hyprlock = lib.ctp.mkCatppuccinOpt { name = "hyprlock"; } // { accent = lib.ctp.mkAccentOpt "hyprlock"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "hyprlock" + "catppuccin" + ]; + to = "hyprlock"; + accentSupport = true; + }; + config = lib.mkIf enable { programs.hyprlock.settings = { source = [ diff --git a/modules/home-manager/imv.nix b/modules/home-manager/imv.nix index 515b954c..92b96dfa 100644 --- a/modules/home-manager/imv.nix +++ b/modules/home-manager/imv.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.imv.catppuccin; + cfg = config.catppuccin.imv; enable = cfg.enable && config.programs.imv.enable; in { - options.programs.imv.catppuccin = lib.ctp.mkCatppuccinOpt { name = "imv"; }; + options.catppuccin.imv = lib.ctp.mkCatppuccinOpt { name = "imv"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "imv" + "catppuccin" + ]; + to = "imv"; + }; config.programs.imv.settings = lib.mkIf enable ( lib.ctp.fromINI (sources.imv + "/themes/${cfg.flavor}.config") diff --git a/modules/home-manager/k9s.nix b/modules/home-manager/k9s.nix index c833ad96..faa0b1e3 100644 --- a/modules/home-manager/k9s.nix +++ b/modules/home-manager/k9s.nix @@ -7,7 +7,7 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.k9s.catppuccin; + cfg = config.catppuccin.k9s; enable = cfg.enable && config.programs.k9s.enable; # NOTE: On MacOS specifically, k9s expects its configuration to be in @@ -20,10 +20,35 @@ let theme = sources.k9s + "/dist/${themeFile}"; in { - options.programs.k9s.catppuccin = lib.ctp.mkCatppuccinOpt { name = "k9s"; } // { + options.catppuccin.k9s = lib.ctp.mkCatppuccinOpt { name = "k9s"; } // { transparent = lib.mkEnableOption "transparent version of flavor"; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "k9s" + "catppuccin" + ]; + to = "k9s"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "k9s" + "catppuccin" + "transparent" + ] + [ + "catppuccin" + "k9s" + "transparent" + ] + ) + ]; + config = lib.mkIf enable ( lib.mkMerge [ (lib.mkIf (!enableXdgConfig) { diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix index a20c96c2..a27ec7f0 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -1,7 +1,7 @@ { config, lib, ... }: let inherit (lib) ctp; - cfg = config.programs.kitty.catppuccin; + cfg = config.catppuccin.kitty; enable = cfg.enable && config.programs.kitty.enable; # TODO: Remove after 24.11 is stable @@ -9,7 +9,16 @@ let attrName = if (lib.versionAtLeast ctp.getModuleRelease "24.11") then "themeFile" else "theme"; in { - options.programs.kitty.catppuccin = ctp.mkCatppuccinOpt { name = "kitty"; }; + options.catppuccin.kitty = ctp.mkCatppuccinOpt { name = "kitty"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "kitty" + "catppuccin" + ]; + to = "kitty"; + }; config = lib.mkIf enable { programs.kitty.${attrName} = "Catppuccin-${ctp.mkUpper cfg.flavor}"; }; } diff --git a/modules/home-manager/kvantum.nix b/modules/home-manager/kvantum.nix index ac86b10c..883e1710 100644 --- a/modules/home-manager/kvantum.nix +++ b/modules/home-manager/kvantum.nix @@ -5,7 +5,7 @@ ... }: let - cfg = config.qt.style.catppuccin; + cfg = config.catppuccin.kvantum; enable = cfg.enable && config.qt.enable; flavorCapitalized = lib.ctp.mkUpper cfg.flavor; @@ -30,7 +30,7 @@ let "Catppuccin-${flavorCapitalized}-${accentCapitalized}"; in { - options.qt.style.catppuccin = lib.ctp.mkCatppuccinOpt { name = "Kvantum"; } // { + options.catppuccin.kvantum = lib.ctp.mkCatppuccinOpt { name = "Kvantum"; } // { accent = lib.ctp.mkAccentOpt "Kvantum"; apply = lib.mkOption { @@ -43,6 +43,32 @@ in }; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "qt" + "style" + "catppuccin" + ]; + to = "kvantum"; + accentSupport = true; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "qt" + "style" + "catppuccin" + "apply" + ] + [ + "catppuccin" + "kvantum" + "apply" + ] + ) + ]; + config = lib.mkIf enable { assertions = [ { diff --git a/modules/home-manager/lazygit.nix b/modules/home-manager/lazygit.nix index 527cffb2..1cb6175d 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -8,7 +8,7 @@ let inherit (lib) ctp; inherit (config.catppuccin) sources; - cfg = config.programs.lazygit.catppuccin; + cfg = config.catppuccin.lazygit; enable = cfg.enable && config.programs.lazygit.enable; # NOTE: On MacOS specifically, k9s expects its configuration to be in @@ -23,10 +23,20 @@ let configFile = "${configDirectory}/lazygit/config.yml"; in { - options.programs.lazygit.catppuccin = lib.ctp.mkCatppuccinOpt { name = "lazygit"; } // { + options.catppuccin.lazygit = lib.ctp.mkCatppuccinOpt { name = "lazygit"; } // { accent = ctp.mkAccentOpt "lazygit"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "lazygit" + "catppuccin" + ]; + to = "lazygit"; + accentSupport = true; + }; + config.home.sessionVariables = lib.mkIf enable { # Ensure that the default config file is still sourced LG_CONFIG_FILE = "${sources.lazygit}/themes-mergable/${cfg.flavor}/${cfg.accent}.yml,${configFile}"; diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index 68ec305a..c51f4f80 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -6,7 +6,7 @@ }: let inherit (config.catppuccin) sources; - cfg = config.services.mako.catppuccin; + cfg = config.catppuccin.mako; enable = cfg.enable && config.services.mako.enable; theme = lib.ctp.fromINI ( sources.mako + "/themes/catppuccin-${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}" @@ -16,10 +16,20 @@ let extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme; in { - options.services.mako.catppuccin = lib.ctp.mkCatppuccinOpt { name = "mako"; } // { + options.catppuccin.mako = lib.ctp.mkCatppuccinOpt { name = "mako"; } // { accent = lib.ctp.mkAccentOpt "mako"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "services" + "mako" + "catppuccin" + ]; + to = "mako"; + accentSupport = true; + }; + # Will cause infinite recursion if config.services.mako is directly set as a whole config.services.mako = lib.mkIf enable { backgroundColor = theme.background-color; diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix index 3db7da63..ca0b3615 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -1,13 +1,22 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.micro.catppuccin; + cfg = config.catppuccin.micro; enable = cfg.enable && config.programs.micro.enable; themePath = "catppuccin-${cfg.flavor}.micro"; in { - options.programs.micro.catppuccin = lib.ctp.mkCatppuccinOpt { name = "micro"; }; + options.catppuccin.micro = lib.ctp.mkCatppuccinOpt { name = "micro"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "micro" + "catppuccin" + ]; + to = "micro"; + }; config = lib.mkIf enable { programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath; diff --git a/modules/home-manager/mpv.nix b/modules/home-manager/mpv.nix index 1f4f39d0..889bf64d 100644 --- a/modules/home-manager/mpv.nix +++ b/modules/home-manager/mpv.nix @@ -2,14 +2,24 @@ let inherit (config.catppuccin) sources; inherit (lib) ctp mkIf; - cfg = config.programs.mpv.catppuccin; + cfg = config.catppuccin.mpv; enable = cfg.enable && config.programs.mpv.enable; in { - options.programs.mpv.catppuccin = ctp.mkCatppuccinOpt { name = "mpv"; } // { + options.catppuccin.mpv = ctp.mkCatppuccinOpt { name = "mpv"; } // { accent = ctp.mkAccentOpt "mpv"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "mpv" + "catppuccin" + ]; + to = "mpv"; + accentSupport = true; + }; + config.programs.mpv = mkIf enable { config.include = sources.mpv + "/themes/${cfg.flavor}/${cfg.accent}.conf"; }; diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index f8adfbfe..56b5bf7c 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -5,11 +5,20 @@ ... }: let - cfg = config.programs.neovim.catppuccin; + cfg = config.catppuccin.nvim; enable = cfg.enable && config.programs.neovim.enable; in { - options.programs.neovim.catppuccin = lib.ctp.mkCatppuccinOpt { name = "neovim"; }; + options.catppuccin.nvim = lib.ctp.mkCatppuccinOpt { name = "nvim"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "neovim" + "catppuccin" + ]; + to = "nvim"; + }; config.programs.neovim = lib.mkIf enable { plugins = with pkgs.vimPlugins; [ diff --git a/modules/home-manager/newsboat.nix b/modules/home-manager/newsboat.nix index e3e79a48..f899a66f 100644 --- a/modules/home-manager/newsboat.nix +++ b/modules/home-manager/newsboat.nix @@ -2,12 +2,21 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.newsboat.catppuccin; + cfg = config.catppuccin.newsboat; enable = cfg.enable && config.programs.newsboat.enable; theme = if cfg.flavor == "latte" then "latte" else "dark"; in { - options.programs.newsboat.catppuccin = lib.ctp.mkCatppuccinOpt { name = "newsboat"; }; + options.catppuccin.newsboat = lib.ctp.mkCatppuccinOpt { name = "newsboat"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "newsboat" + "catppuccin" + ]; + to = "newsboat"; + }; config = lib.mkIf enable { programs.newsboat.extraConfig = builtins.readFile "${sources.newsboat}/themes/${theme}"; diff --git a/modules/home-manager/obs-studio.nix b/modules/home-manager/obs.nix similarity index 63% rename from modules/home-manager/obs-studio.nix rename to modules/home-manager/obs.nix index fe328981..3edb617f 100644 --- a/modules/home-manager/obs-studio.nix +++ b/modules/home-manager/obs.nix @@ -1,13 +1,22 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.obs-studio.catppuccin; + cfg = config.catppuccin.obs; enable = cfg.enable && config.programs.obs-studio.enable; themeName = "Catppuccin_${lib.ctp.mkUpper cfg.flavor}.ovt"; in { - options.programs.obs-studio.catppuccin = lib.ctp.mkCatppuccinOpt { name = "obs-studio"; }; + options.catppuccin.obs = lib.ctp.mkCatppuccinOpt { name = "obs"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "obs-studio" + "catppuccin" + ]; + to = "obs"; + }; config = lib.mkIf enable { xdg.configFile."obs-studio/themes/Catppuccin.obt".source = "${sources.obs}/themes/Catppuccin.obt"; diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index 3a6636ba..edf6713e 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.services.polybar.catppuccin; + cfg = config.catppuccin.polybar; enable = cfg.enable && config.services.polybar.enable; in { - options.services.polybar.catppuccin = lib.ctp.mkCatppuccinOpt { name = "polybar"; }; + options.catppuccin.polybar = lib.ctp.mkCatppuccinOpt { name = "polybar"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "services" + "polybar" + "catppuccin" + ]; + to = "polybar"; + }; config.services.polybar.extraConfig = lib.mkIf enable ( builtins.readFile "${sources.polybar}/themes/${cfg.flavor}.ini" diff --git a/modules/home-manager/rio.nix b/modules/home-manager/rio.nix index dd018299..e75c31f3 100644 --- a/modules/home-manager/rio.nix +++ b/modules/home-manager/rio.nix @@ -3,11 +3,20 @@ let inherit (lib) ctp; inherit (config.catppuccin) sources; - cfg = config.programs.rio.catppuccin; + cfg = config.catppuccin.rio; enable = cfg.enable && config.programs.rio.enable; in { - options.programs.rio.catppuccin = ctp.mkCatppuccinOpt { name = "rio"; }; + options.catppuccin.rio = ctp.mkCatppuccinOpt { name = "rio"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "rio" + "catppuccin" + ]; + to = "rio"; + }; config = lib.mkIf enable { programs.rio.settings = lib.importTOML "${sources.rio}/themes/catppuccin-${cfg.flavor}.toml"; diff --git a/modules/home-manager/rofi.nix b/modules/home-manager/rofi.nix index 7fa6cad7..c8e7ba14 100644 --- a/modules/home-manager/rofi.nix +++ b/modules/home-manager/rofi.nix @@ -2,11 +2,20 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.rofi.catppuccin; + cfg = config.catppuccin.rofi; enable = cfg.enable && config.programs.rofi.enable; in { - options.programs.rofi.catppuccin = lib.ctp.mkCatppuccinOpt { name = "rofi"; }; + options.catppuccin.rofi = lib.ctp.mkCatppuccinOpt { name = "rofi"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "rofi" + "catppuccin" + ]; + to = "rofi"; + }; config.programs.rofi = lib.mkIf enable { theme = { diff --git a/modules/home-manager/skim.nix b/modules/home-manager/skim.nix index 9eda30ff..5443dcef 100644 --- a/modules/home-manager/skim.nix +++ b/modules/home-manager/skim.nix @@ -1,12 +1,21 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.skim.catppuccin; + cfg = config.catppuccin.skim; enable = cfg.enable && config.programs.skim.enable; palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; in { - options.programs.skim.catppuccin = lib.ctp.mkCatppuccinOpt { name = "skim"; }; + options.catppuccin.skim = lib.ctp.mkCatppuccinOpt { name = "skim"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "skim" + "catppuccin" + ]; + to = "skim"; + }; config.programs.skim = lib.mkIf enable { defaultOptions = [ diff --git a/modules/home-manager/spotify-player.nix b/modules/home-manager/spotify-player.nix index 1a325ba0..8f4ed115 100644 --- a/modules/home-manager/spotify-player.nix +++ b/modules/home-manager/spotify-player.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.spotify-player.catppuccin; + cfg = config.catppuccin.spotify-player; enable = cfg.enable && config.programs.spotify-player.enable; in { - options.programs.spotify-player.catppuccin = lib.ctp.mkCatppuccinOpt { name = "spotify-player"; }; + options.catppuccin.spotify-player = lib.ctp.mkCatppuccinOpt { name = "spotify-player"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "spotify-player" + "catppuccin" + ]; + to = "spotify-player"; + }; config = lib.mkIf enable { programs.spotify-player = { diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 069d6e80..daab19fe 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.starship.catppuccin; + cfg = config.catppuccin.starship; enable = cfg.enable && config.programs.starship.enable; in { - options.programs.starship.catppuccin = lib.ctp.mkCatppuccinOpt { name = "starship"; }; + options.catppuccin.starship = lib.ctp.mkCatppuccinOpt { name = "starship"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "starship" + "catppuccin" + ]; + to = "starship"; + }; config.programs.starship.settings = lib.mkIf enable ( { diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index d392f8a7..4382c8d8 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -1,12 +1,22 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.wayland.windowManager.sway.catppuccin; + cfg = config.catppuccin.sway; enable = cfg.enable && config.wayland.windowManager.sway.enable; theme = "${sources.sway}/themes/catppuccin-${cfg.flavor}"; in { - options.wayland.windowManager.sway.catppuccin = lib.ctp.mkCatppuccinOpt { name = "sway"; }; + options.catppuccin.sway = lib.ctp.mkCatppuccinOpt { name = "sway"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "wayland" + "windowManager" + "sway" + "catppuccin" + ]; + to = "sway"; + }; config = lib.mkIf enable { wayland.windowManager.sway.extraConfigEarly = '' diff --git a/modules/home-manager/swaylock.nix b/modules/home-manager/swaylock.nix index 93e490bb..d3a4efde 100644 --- a/modules/home-manager/swaylock.nix +++ b/modules/home-manager/swaylock.nix @@ -1,10 +1,10 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.swaylock.catppuccin; + cfg = config.catppuccin.swaylock; in { - options.programs.swaylock.catppuccin = { + options.catppuccin.swaylock = { enable = lib.mkEnableOption "Catppuccin theme" // { /* global `catppuccin.enable` purposefully doesn't work here in configurations with a `home.stateVersion` @@ -33,6 +33,15 @@ in flavor = lib.ctp.mkFlavorOpt "swaylock"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "swaylock" + "catppuccin" + ]; + to = "swaylock"; + }; + config = lib.mkIf cfg.enable { programs.swaylock.settings = lib.ctp.fromINI (sources.swaylock + "/themes/${cfg.flavor}.conf"); }; diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index 7cfab569..bfcb3f2a 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -12,7 +12,7 @@ let concatStrings ; inherit (config.catppuccin) sources; - cfg = config.programs.tmux.catppuccin; + cfg = config.catppuccin.tmux; enable = cfg.enable && config.programs.tmux.enable; plugin = @@ -24,7 +24,7 @@ let }; in { - options.programs.tmux.catppuccin = ctp.mkCatppuccinOpt { name = "tmux"; } // { + options.catppuccin.tmux = ctp.mkCatppuccinOpt { name = "tmux"; } // { extraConfig = mkOption { type = types.lines; description = "Additional configuration for the catppuccin plugin."; @@ -35,6 +35,31 @@ in }; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "tmux" + "catppuccin" + ]; + to = "tmux"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "tmux" + "catppuccin" + "extraConfig" + ] + [ + "catppuccin" + "tmux" + "extraConfig" + ] + ) + ]; + config.programs.tmux.plugins = lib.mkIf enable [ { inherit plugin; diff --git a/modules/home-manager/tofi.nix b/modules/home-manager/tofi.nix index 39950617..30ddbfee 100644 --- a/modules/home-manager/tofi.nix +++ b/modules/home-manager/tofi.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.tofi.catppuccin; + cfg = config.catppuccin.tofi; enable = cfg.enable && config.programs.tofi.enable; in { - options.programs.tofi.catppuccin = lib.ctp.mkCatppuccinOpt { name = "tofi"; }; + options.catppuccin.tofi = lib.ctp.mkCatppuccinOpt { name = "tofi"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "tofi" + "catppuccin" + ]; + to = "tofi"; + }; config.programs.tofi = lib.mkIf enable { settings.include = sources.tofi + "/themes/catppuccin-${cfg.flavor}"; diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix index df54cbb8..47e6d387 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -1,12 +1,12 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.waybar.catppuccin; + cfg = config.catppuccin.waybar; enable = cfg.enable && config.programs.waybar.enable; styleFile = "${sources.waybar}/themes/${cfg.flavor}.css"; in { - options.programs.waybar.catppuccin = lib.ctp.mkCatppuccinOpt { name = "waybar"; } // { + options.catppuccin.waybar = lib.ctp.mkCatppuccinOpt { name = "waybar"; } // { mode = lib.mkOption { type = lib.types.enum [ "prependImport" @@ -22,6 +22,31 @@ in }; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "waybar" + "catppuccin" + ]; + to = "waybar"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "waybar" + "catppuccin" + "mode" + ] + [ + "catppuccin" + "waybar" + "mode" + ] + ) + ]; + config = lib.mkIf enable ( lib.mkMerge [ (lib.mkIf (cfg.mode == "prependImport") { diff --git a/modules/home-manager/yazi.nix b/modules/home-manager/yazi.nix index 3a1a6658..b8b0e3f8 100644 --- a/modules/home-manager/yazi.nix +++ b/modules/home-manager/yazi.nix @@ -2,14 +2,24 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.yazi.catppuccin; + cfg = config.catppuccin.yazi; enable = cfg.enable && config.programs.yazi.enable; in { - options.programs.yazi.catppuccin = lib.ctp.mkCatppuccinOpt { name = "yazi"; } // { + options.catppuccin.yazi = lib.ctp.mkCatppuccinOpt { name = "yazi"; } // { accent = lib.ctp.mkAccentOpt "yazi"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "yazi" + "catppuccin" + ]; + to = "yazi"; + accentSupport = true; + }; + config = lib.mkIf enable { programs.yazi.theme = lib.importTOML "${sources.yazi}/themes/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.toml"; xdg.configFile."yazi/Catppuccin-${cfg.flavor}.tmTheme".source = "${sources.bat}/themes/Catppuccin ${lib.ctp.mkUpper cfg.flavor}.tmTheme"; diff --git a/modules/home-manager/zathura.nix b/modules/home-manager/zathura.nix index 488ffe53..348a384c 100644 --- a/modules/home-manager/zathura.nix +++ b/modules/home-manager/zathura.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.programs.zathura.catppuccin; + cfg = config.catppuccin.zathura; enable = cfg.enable && config.programs.zathura.enable; in { - options.programs.zathura.catppuccin = lib.ctp.mkCatppuccinOpt { name = "zathura"; }; + options.catppuccin.zathura = lib.ctp.mkCatppuccinOpt { name = "zathura"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "zathura" + "catppuccin" + ]; + to = "zathura"; + }; config.programs.zathura.extraConfig = lib.mkIf enable '' include ${sources.zathura + "/src/catppuccin-${cfg.flavor}"} diff --git a/modules/home-manager/zellij.nix b/modules/home-manager/zellij.nix index 7d2e5d26..ec4d5959 100644 --- a/modules/home-manager/zellij.nix +++ b/modules/home-manager/zellij.nix @@ -1,11 +1,20 @@ { config, lib, ... }: let - cfg = config.programs.zellij.catppuccin; + cfg = config.catppuccin.zellij; enable = cfg.enable && config.programs.zellij.enable; themeName = "catppuccin-${cfg.flavor}"; in { - options.programs.zellij.catppuccin = lib.ctp.mkCatppuccinOpt { name = "zellij"; }; + options.catppuccin.zellij = lib.ctp.mkCatppuccinOpt { name = "zellij"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "programs" + "zellij" + "catppuccin" + ]; + to = "zellij"; + }; config = lib.mkIf enable { programs.zellij.settings = { diff --git a/modules/home-manager/zsh-syntax-highlighting.nix b/modules/home-manager/zsh-syntax-highlighting.nix index 3269d030..e4cda646 100644 --- a/modules/home-manager/zsh-syntax-highlighting.nix +++ b/modules/home-manager/zsh-syntax-highlighting.nix @@ -1,18 +1,44 @@ +# In this file we define both `catppuccin.zsh-syntax-highlighting` and `programs.zsh.syntaxHighlighting.catppuccin` options this is beacuse +# we have to recreate the lib.mkRenamedOptionModule here due to the use of a submodule being used for `programs.zsh.syntaxHighlighting` +# which would lead to an error if we used the original `lib.mkRenamedOptionModule`. +# see { config, lib, ... }: let inherit (config.catppuccin) sources; inherit (lib) ctp; - cfg = config.programs.zsh.syntaxHighlighting.catppuccin; + cfg = config.catppuccin.zsh-syntax-highlighting; enable = cfg.enable && config.programs.zsh.syntaxHighlighting.enable; + + oldCfg = config.programs.zsh.syntaxHighlighting.catppuccin; in { - options.programs.zsh.syntaxHighlighting.catppuccin = ctp.mkCatppuccinOpt { - name = "Zsh Syntax Highlighting"; - }; + options = { + catppuccin.zsh-syntax-highlighting = ctp.mkCatppuccinOpt { + name = "Zsh Syntax Highlighting"; + enableDefault = config.catppuccin.enable || oldCfg.enable; + }; - config.programs.zsh = lib.mkIf enable { - initExtra = lib.mkBefore '' - source '${sources.zsh-syntax-highlighting}/themes/catppuccin_${cfg.flavor}-zsh-syntax-highlighting.zsh' - ''; + programs.zsh.syntaxHighlighting.catppuccin = ctp.mkCatppuccinOpt { + name = "Zsh Syntax Highlighting"; + enableDefault = false; + }; }; + + config = lib.mkIf enable ( + lib.mkMerge [ + { + programs.zsh.initExtra = lib.mkBefore '' + source '${sources.zsh-syntax-highlighting}/themes/catppuccin_${cfg.flavor}-zsh-syntax-highlighting.zsh' + ''; + + catppuccin.zsh-syntax-highlighting.flavor = lib.mkDefault oldCfg.flavor; + } + + (lib.mkIf oldCfg.enable { + warnings = [ + "`programs.zsh.syntaxHighlighting.catppuccin.enable` is deprecated. Please use `catppuccin.zsh-syntax-highlighting.enable` instead." + ]; + }) + ] + ); } diff --git a/modules/lib/default.nix b/modules/lib/default.nix index ec446745..3cf7b44e 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -159,4 +159,56 @@ in assertion = lib.versionAtLeast ctp.getModuleRelease version; message = "`catppuccin/nix` requires at least version ${version} of NixOS/home-manager"; }; + + # a -> list + # this is used to make old modules to new modules + mkRenamedCatppuccinOpts = + { + from, + to, + accentSupport ? false, + }: + [ + (lib.mkRenamedOptionModule + ( + from + ++ [ + "enable" + ] + ) + [ + "catppuccin" + to + "enable" + ] + ) + + (lib.mkRenamedOptionModule + ( + from + ++ [ + "flavor" + ] + ) + [ + "catppuccin" + to + "flavor" + ] + ) + ] + ++ lib.optional accentSupport ( + lib.mkRenamedOptionModule + ( + from + ++ [ + "accent" + ] + ) + [ + "catppuccin" + to + "accent" + ] + ); } diff --git a/modules/nixos/all-modules.nix b/modules/nixos/all-modules.nix index f74516ae..e48957e7 100644 --- a/modules/nixos/all-modules.nix +++ b/modules/nixos/all-modules.nix @@ -1,8 +1,8 @@ [ - ./console.nix ./fcitx5.nix ./globals.nix ./grub.nix ./plymouth.nix ./sddm.nix + ./tty.nix ] diff --git a/modules/nixos/fcitx5.nix b/modules/nixos/fcitx5.nix index 43dcc544..be604fed 100644 --- a/modules/nixos/fcitx5.nix +++ b/modules/nixos/fcitx5.nix @@ -6,7 +6,7 @@ }: let inherit (config.catppuccin) sources; - cfg = config.i18n.inputMethod.fcitx5.catppuccin; + cfg = config.catppuccin.fcitx5; enable = cfg.enable && ( @@ -20,10 +20,21 @@ let ''; in { - options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt { name = "Fcitx5"; } // { + options.catppuccin.fcitx5 = lib.ctp.mkCatppuccinOpt { name = "Fcitx5"; } // { accent = lib.ctp.mkAccentOpt "Fcitx5"; }; + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "i18n" + "inputMethod" + "fcitx5" + "catppuccin" + ]; + to = "fcitx5"; + accentSupport = true; + }; + config.i18n.inputMethod.fcitx5 = lib.mkIf enable { addons = [ theme ]; settings.addons.classicui.globalSection.Theme = "catppuccin-${cfg.flavor}-${cfg.accent}"; diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 8458d8fe..c9228211 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -6,7 +6,7 @@ }: let inherit (config.catppuccin) sources; - cfg = config.boot.loader.grub.catppuccin; + cfg = config.catppuccin.grub; enable = cfg.enable && config.boot.loader.grub.enable; # TODO @getchoo: upstream this in nixpkgs maybe? idk if they have grub themes @@ -16,7 +16,17 @@ let ''; in { - options.boot.loader.grub.catppuccin = lib.ctp.mkCatppuccinOpt { name = "grub"; }; + options.catppuccin.grub = lib.ctp.mkCatppuccinOpt { name = "grub"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "boot" + "loader" + "grub" + "catppuccin" + ]; + to = "grub"; + }; config.boot.loader.grub = lib.mkIf enable { font = "${theme}/font.pf2"; diff --git a/modules/nixos/plymouth.nix b/modules/nixos/plymouth.nix index 073ee14b..f2b456bd 100644 --- a/modules/nixos/plymouth.nix +++ b/modules/nixos/plymouth.nix @@ -6,11 +6,20 @@ }: let inherit (lib) ctp mkIf; - cfg = config.boot.plymouth.catppuccin; + cfg = config.catppuccin.plymouth; enable = cfg.enable && config.boot.plymouth.enable; in { - options.boot.plymouth.catppuccin = ctp.mkCatppuccinOpt { name = "plymouth"; }; + options.catppuccin.plymouth = ctp.mkCatppuccinOpt { name = "plymouth"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "boot" + "plymouth" + "catppuccin" + ]; + to = "plymouth"; + }; config.boot.plymouth = mkIf enable { theme = "catppuccin-${cfg.flavor}"; diff --git a/modules/nixos/sddm.nix b/modules/nixos/sddm.nix index 3f03b020..94de2a93 100644 --- a/modules/nixos/sddm.nix +++ b/modules/nixos/sddm.nix @@ -11,12 +11,11 @@ let types mkOption ; - cfg = config.services.displayManager.sddm.catppuccin; + cfg = config.catppuccin.sddm; enable = cfg.enable && config.services.displayManager.sddm.enable; in - { - options.services.displayManager.sddm.catppuccin = ctp.mkCatppuccinOpt { name = "sddm"; } // { + options.catppuccin.sddm = ctp.mkCatppuccinOpt { name = "sddm"; } // { font = mkOption { type = types.str; default = "Noto Sans"; @@ -52,6 +51,93 @@ in }; }; + imports = + (lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "services" + "displayManager" + "sddm" + "catppuccin" + ]; + to = "sddm"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "services" + "displayManager" + "sddm" + "catppuccin" + "font" + ] + [ + "catppuccin" + "sddm" + "font" + ] + ) + + (lib.mkRenamedOptionModule + [ + "services" + "displayManager" + "sddm" + "catppuccin" + "fontSize" + ] + [ + "catppuccin" + "sddm" + "fontSize" + ] + ) + + (lib.mkRenamedOptionModule + [ + "services" + "displayManager" + "sddm" + "catppuccin" + "background" + ] + [ + "catppuccin" + "sddm" + "background" + ] + ) + + (lib.mkRenamedOptionModule + [ + "services" + "displayManager" + "sddm" + "catppuccin" + "loginBackground" + ] + [ + "catppuccin" + "sddm" + "loginBackground" + ] + ) + + (lib.mkRenamedOptionModule + [ + "services" + "displayManager" + "sddm" + "catppuccin" + "assertQt6Sddm" + ] + [ + "catppuccin" + "sddm" + "assertQt6Sddm" + ] + ) + ]; + config = mkIf enable { assertions = lib.optional cfg.assertQt6Sddm { assertion = config.services.displayManager.sddm.package == pkgs.kdePackages.sddm; diff --git a/modules/nixos/console.nix b/modules/nixos/tty.nix similarity index 74% rename from modules/nixos/console.nix rename to modules/nixos/tty.nix index 48844ba5..33f176a0 100644 --- a/modules/nixos/console.nix +++ b/modules/nixos/tty.nix @@ -1,12 +1,20 @@ { config, lib, ... }: let inherit (config.catppuccin) sources; - cfg = config.console.catppuccin; + cfg = config.catppuccin.tty; enable = cfg.enable && config.console.enable; palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; in { - options.console.catppuccin = lib.ctp.mkCatppuccinOpt { name = "console"; }; + options.catppuccin.tty = lib.ctp.mkCatppuccinOpt { name = "console"; }; + + imports = lib.ctp.mkRenamedCatppuccinOpts { + from = [ + "console" + "catppuccin" + ]; + to = "tty"; + }; config.console.colors = lib.mkIf enable ( # Manually populate with colors from catppuccin/tty