diff --git a/docs/mk-search.nix b/docs/mk-search.nix index 12455133..0f97bad0 100644 --- a/docs/mk-search.nix +++ b/docs/mk-search.nix @@ -3,7 +3,7 @@ { catppuccin, versionName }: let - urlPrefix = "https://github.com/catppuccin/nix/tree/${catppuccin.rev}/"; + urlPrefix = "https://github.com/catppuccin/nix/tree/${catppuccin.rev or "main"}/"; in mkMultiSearch { diff --git a/modules/home-manager/aerc.nix b/modules/home-manager/aerc.nix index da8162f0..afc6c406 100644 --- a/modules/home-manager/aerc.nix +++ b/modules/home-manager/aerc.nix @@ -3,13 +3,20 @@ let inherit (config.catppuccin) sources; - - cfg = config.programs.aerc.catppuccin; + cfg = config.catppuccin.aerc; themeName = "catppuccin-${cfg.flavor}"; in - { - options.programs.aerc.catppuccin = catppuccinLib.mkCatppuccinOption { name = "aerc"; }; + options.catppuccin.aerc = catppuccinLib.mkCatppuccinOption { name = "aerc"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "aerc" + "catppuccin" + ]; + to = "aerc"; + }; config = lib.mkIf cfg.enable { programs.aerc = { diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 044a66c9..4d8cf0d5 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -3,12 +3,19 @@ let inherit (config.catppuccin) sources; - - cfg = config.programs.alacritty.catppuccin; + cfg = config.catppuccin.alacritty; in - { - options.programs.alacritty.catppuccin = catppuccinLib.mkCatppuccinOption { name = "alacritty"; }; + options.catppuccin.alacritty = catppuccinLib.mkCatppuccinOption { name = "alacritty"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "alacritty" + "catppuccin" + ]; + to = "alacritty"; + }; config = lib.mkIf cfg.enable { programs.alacritty = { diff --git a/modules/home-manager/all-modules.nix b/modules/home-manager/all-modules.nix index 8233f298..99793ed7 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 @@ -41,7 +41,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 56fcb0e1..3a3b1afc 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -3,13 +3,20 @@ let inherit (config.catppuccin) sources; - - cfg = config.programs.bat.catppuccin; + cfg = config.catppuccin.bat; themeName = "Catppuccin ${catppuccinLib.mkUpper cfg.flavor}"; in - { - options.programs.bat.catppuccin = catppuccinLib.mkCatppuccinOption { name = "bat"; }; + options.catppuccin.bat = catppuccinLib.mkCatppuccinOption { name = "bat"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "bat" + "catppuccin" + ]; + to = "bat"; + }; config = lib.mkIf cfg.enable { programs.bat = { diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index d88ccb2e..50886987 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -3,12 +3,19 @@ let inherit (config.catppuccin) sources; - - cfg = config.programs.bottom.catppuccin; + cfg = config.catppuccin.bottom; in - { - options.programs.bottom.catppuccin = catppuccinLib.mkCatppuccinOption { name = "bottom"; }; + options.catppuccin.bottom = catppuccinLib.mkCatppuccinOption { name = "bottom"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "bottom" + "catppuccin" + ]; + to = "bottom"; + }; config = lib.mkIf cfg.enable { programs.bottom = { diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index 01b60380..74af8642 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -4,7 +4,7 @@ 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"; @@ -13,7 +13,16 @@ let in { - options.programs.btop.catppuccin = catppuccinLib.mkCatppuccinOption { name = "btop"; }; + options.catppuccin.btop = catppuccinLib.mkCatppuccinOption { name = "btop"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "btop" + "catppuccin" + ]; + to = "btop"; + }; config = lib.mkIf enable { xdg.configFile = { diff --git a/modules/home-manager/cava.nix b/modules/home-manager/cava.nix index cca59f49..e609dfbf 100644 --- a/modules/home-manager/cava.nix +++ b/modules/home-manager/cava.nix @@ -4,15 +4,39 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.cava.catppuccin; + cfg = config.catppuccin.cava; flavor = "${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent"; in - { - options.programs.cava.catppuccin = catppuccinLib.mkCatppuccinOption { name = "cava"; } // { + options.catppuccin.cava = catppuccinLib.mkCatppuccinOption { name = "cava"; } // { transparent = lib.mkEnableOption "transparent version of flavor"; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "cava" + "catppuccin" + ]; + to = "cava"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "cava" + "catppuccin" + "transparent" + ] + [ + "catppuccin" + "cava" + "transparent" + ] + ) + ]; + config = lib.mkIf cfg.enable { programs.cava = { settings = catppuccinLib.fromINIRaw (sources.cava + "/themes/${flavor}.cava"); diff --git a/modules/home-manager/cursor.nix b/modules/home-manager/cursors.nix similarity index 79% rename from modules/home-manager/cursor.nix rename to modules/home-manager/cursors.nix index fe8c9bca..9fb9c016 100644 --- a/modules/home-manager/cursor.nix +++ b/modules/home-manager/cursors.nix @@ -7,7 +7,7 @@ }: let - cfg = config.catppuccin.pointerCursor; + cfg = config.catppuccin.cursors; # "dark" and "light" can be used alongside the regular accents cursorAccentType = catppuccinLib.mergeEnums catppuccinLib.types.accent ( @@ -19,7 +19,7 @@ let in { - options.catppuccin.pointerCursor = + options.catppuccin.cursors = catppuccinLib.mkCatppuccinOption { name = "pointer cursors"; # NOTE: We exclude this as there is no `enable` option in the upstream @@ -34,6 +34,15 @@ in }; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "catppuccin" + "pointerCursor" + ]; + to = "cursors"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { home.pointerCursor = { name = "catppuccin-${cfg.flavor}-${cfg.accent}-cursors"; diff --git a/modules/home-manager/delta.nix b/modules/home-manager/delta.nix index a60afe69..4ea9f323 100644 --- a/modules/home-manager/delta.nix +++ b/modules/home-manager/delta.nix @@ -4,12 +4,22 @@ 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 = catppuccinLib.mkCatppuccinOption { name = "delta"; }; + options.catppuccin.delta = catppuccinLib.mkCatppuccinOption { name = "delta"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + 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 e7204a49..15cc280d 100644 --- a/modules/home-manager/dunst.nix +++ b/modules/home-manager/dunst.nix @@ -4,12 +4,12 @@ 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 = catppuccinLib.mkCatppuccinOption { name = "dunst"; } // { + options.catppuccin.dunst = catppuccinLib.mkCatppuccinOption { name = "dunst"; } // { prefix = lib.mkOption { type = lib.types.str; default = "00"; @@ -17,6 +17,31 @@ in }; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + 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 3d831046..66cd394b 100644 --- a/modules/home-manager/fcitx5.nix +++ b/modules/home-manager/fcitx5.nix @@ -4,12 +4,12 @@ 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 = + options.catppuccin.fcitx5 = catppuccinLib.mkCatppuccinOption { name = "Fcitx5"; accentSupport = true; @@ -25,6 +25,34 @@ in }; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + 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}" = { diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index 8feb523e..adf37673 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -4,7 +4,7 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.fish.catppuccin; + cfg = config.catppuccin.fish; enable = cfg.enable && config.programs.fish.enable; themeName = "Catppuccin ${catppuccinLib.mkUpper cfg.flavor}"; @@ -12,7 +12,16 @@ let in { - options.programs.fish.catppuccin = catppuccinLib.mkCatppuccinOption { name = "fish"; }; + options.catppuccin.fish = catppuccinLib.mkCatppuccinOption { name = "fish"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + 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 fc678180..2e5054f2 100644 --- a/modules/home-manager/foot.nix +++ b/modules/home-manager/foot.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.foot.catppuccin; + cfg = config.catppuccin.foot; in - { - options.programs.foot.catppuccin = catppuccinLib.mkCatppuccinOption { name = "foot"; }; + options.catppuccin.foot = catppuccinLib.mkCatppuccinOption { name = "foot"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "foot" + "catppuccin" + ]; + to = "foot"; + }; config = lib.mkIf cfg.enable { programs.foot = { diff --git a/modules/home-manager/freetube.nix b/modules/home-manager/freetube.nix index d7fd1875..048c58ae 100644 --- a/modules/home-manager/freetube.nix +++ b/modules/home-manager/freetube.nix @@ -5,11 +5,11 @@ let inherit (catppuccinLib) mkUpper; inherit (config.programs.freetube.settings) baseTheme; - cfg = config.programs.freetube.catppuccin; + cfg = config.catppuccin.freetube; in { - options.programs.freetube.catppuccin = + options.catppuccin.freetube = catppuccinLib.mkCatppuccinOption { name = "freetube"; accentSupport = true; @@ -25,6 +25,32 @@ in }; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "freetube" + "catppuccin" + ]; + to = "freetube"; + accentSupport = true; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "freetube" + "catppuccin" + "secondaryAccent" + ] + [ + "catppuccin" + "freetube" + "secondaryAccent" + ] + ) + ]; + config = lib.mkIf cfg.enable { programs.freetube.settings = { # NOTE: For some reason, baseTheme does not capitalize first letter, but the other settings do diff --git a/modules/home-manager/fuzzel.nix b/modules/home-manager/fuzzel.nix index 920dbdfd..d4079529 100644 --- a/modules/home-manager/fuzzel.nix +++ b/modules/home-manager/fuzzel.nix @@ -4,15 +4,25 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.fuzzel.catppuccin; + cfg = config.catppuccin.fuzzel; in { - options.programs.fuzzel.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.fuzzel = catppuccinLib.mkCatppuccinOption { name = "fuzzel"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "fuzzel" + "catppuccin" + ]; + to = "fuzzel"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { programs.fuzzel = { settings = { diff --git a/modules/home-manager/fzf.nix b/modules/home-manager/fzf.nix index a8eabce9..88cfc1fc 100644 --- a/modules/home-manager/fzf.nix +++ b/modules/home-manager/fzf.nix @@ -4,7 +4,7 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.fzf.catppuccin; + cfg = config.catppuccin.fzf; palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; # Manually populate with colors from catppuccin/fzf @@ -26,11 +26,21 @@ let in { - options.programs.fzf.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.fzf = catppuccinLib.mkCatppuccinOption { name = "fzf"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "fzf" + "catppuccin" + ]; + to = "fzf"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { programs.fzf = { inherit colors; diff --git a/modules/home-manager/gh-dash.nix b/modules/home-manager/gh-dash.nix index 83b51afc..f6824274 100644 --- a/modules/home-manager/gh-dash.nix +++ b/modules/home-manager/gh-dash.nix @@ -4,16 +4,26 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.gh-dash.catppuccin; + cfg = config.catppuccin.gh-dash; theme = "${sources.gh-dash}/themes/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml"; in { - options.programs.gh-dash.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.gh-dash = catppuccinLib.mkCatppuccinOption { name = "gh-dash"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "gh-dash" + "catppuccin" + ]; + to = "gh-dash"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { programs.gh-dash = { settings = catppuccinLib.fromYaml theme; diff --git a/modules/home-manager/gitui.nix b/modules/home-manager/gitui.nix index 7374a837..c8c7b751 100644 --- a/modules/home-manager/gitui.nix +++ b/modules/home-manager/gitui.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.gitui.catppuccin; + cfg = config.catppuccin.gitui; in - { - options.programs.gitui.catppuccin = catppuccinLib.mkCatppuccinOption { name = "gitui"; }; + options.catppuccin.gitui = catppuccinLib.mkCatppuccinOption { name = "gitui"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "gitui" + "catppuccin" + ]; + to = "gitui"; + }; config = lib.mkIf cfg.enable { programs.gitui.theme = builtins.path { diff --git a/modules/home-manager/glamour.nix b/modules/home-manager/glamour.nix index cd1488e4..6f8f959e 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -4,11 +4,20 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.glamour.catppuccin; + cfg = config.catppuccin.glamour; in { - options.programs.glamour.catppuccin = catppuccinLib.mkCatppuccinOption { name = "glamour"; }; + options.catppuccin.glamour = catppuccinLib.mkCatppuccinOption { name = "glamour"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "glamour" + "catppuccin" + ]; + to = "glamour"; + }; config = lib.mkIf cfg.enable { home.sessionVariables = { diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index cf27ab70..44910de7 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -17,12 +17,12 @@ let types ; - cfg = config.gtk.catppuccin; + cfg = config.catppuccin.gtk; enable = cfg.enable && config.gtk.enable; in { - options.gtk.catppuccin = + options.catppuccin.gtk = catppuccinLib.mkCatppuccinOption { name = "gtk"; useGlobalEnable = false; @@ -64,49 +64,77 @@ in }; }; - imports = [ - (mkRenamedOptionModule - [ + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "gtk" "catppuccin" - "cursor" - "enable" - ] - [ - "catppuccin" - "pointerCursor" - "enable" - ] - ) - - (mkRenamedOptionModule - [ - "gtk" - "catppuccin" - "cursor" - "flavor" - ] - [ - "catppuccin" - "pointerCursor" - "flavor" - ] - ) - - (mkRenamedOptionModule - [ + ]; + to = "gtk"; + accentSupport = true; + }) + ++ (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "gtk" "catppuccin" "cursor" - "accent" - ] - [ - "catppuccin" - "pointerCursor" - "accent" - ] - ) - ]; + ]; + to = "cursors"; + accentSupport = true; + }) + ++ [ + (mkRenamedOptionModule + [ + "gtk" + "catppuccin" + "size" + ] + [ + "catppuccin" + "gtk" + "size" + ] + ) + + (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 87eac7f6..b3bd1eb8 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -4,15 +4,40 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.helix.catppuccin; + cfg = config.catppuccin.helix; subdir = if cfg.useItalics then "default" else "no_italics"; in { - options.programs.helix.catppuccin = catppuccinLib.mkCatppuccinOption { name = "helix"; } // { + options.catppuccin.helix = catppuccinLib.mkCatppuccinOption { name = "helix"; } // { useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix"; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "helix" + "catppuccin" + ]; + to = "helix"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "helix" + "catppuccin" + "useItalics" + ] + [ + "catppuccin" + "helix" + "useItalics" + ] + ) + ]; + config = lib.mkIf cfg.enable { programs.helix = { settings = { @@ -20,8 +45,7 @@ in editor.color-modes = lib.mkDefault true; }; - themes."catppuccin-${cfg.flavor}" = - lib.importTOML "${sources.helix}/themes/${subdir}/catppuccin_${cfg.flavor}.toml"; + themes."catppuccin-${cfg.flavor}" = lib.importTOML "${sources.helix}/themes/${subdir}/catppuccin_${cfg.flavor}.toml"; }; }; } diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index 8cdcf5c7..e6283499 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -7,22 +7,31 @@ }: 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 = catppuccinLib.mkCatppuccinOption { + options.catppuccin.hyprland = catppuccinLib.mkCatppuccinOption { name = "hyprland"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "wayland" + "windowManager" + "hyprland" + "catppuccin" + ]; + to = "hyprland"; + }; + 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 = { diff --git a/modules/home-manager/hyprlock.nix b/modules/home-manager/hyprlock.nix index e792b028..447fdf5e 100644 --- a/modules/home-manager/hyprlock.nix +++ b/modules/home-manager/hyprlock.nix @@ -9,15 +9,25 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.hyprlock.catppuccin; + cfg = config.catppuccin.hyprlock; in { - options.programs.hyprlock.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.hyprlock = catppuccinLib.mkCatppuccinOption { name = "hyprlock"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "hyprlock" + "catppuccin" + ]; + to = "hyprlock"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { programs.hyprlock = { settings = { diff --git a/modules/home-manager/imv.nix b/modules/home-manager/imv.nix index 869823c1..efc1d03a 100644 --- a/modules/home-manager/imv.nix +++ b/modules/home-manager/imv.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.imv.catppuccin; + cfg = config.catppuccin.imv; in - { - options.programs.imv.catppuccin = catppuccinLib.mkCatppuccinOption { name = "imv"; }; + options.catppuccin.imv = catppuccinLib.mkCatppuccinOption { name = "imv"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "imv" + "catppuccin" + ]; + to = "imv"; + }; config = lib.mkIf cfg.enable { programs.imv = { diff --git a/modules/home-manager/k9s.nix b/modules/home-manager/k9s.nix index d5077953..ac1de2af 100644 --- a/modules/home-manager/k9s.nix +++ b/modules/home-manager/k9s.nix @@ -9,7 +9,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 @@ -23,10 +23,35 @@ let in { - options.programs.k9s.catppuccin = catppuccinLib.mkCatppuccinOption { name = "k9s"; } // { + options.catppuccin.k9s = catppuccinLib.mkCatppuccinOption { name = "k9s"; } // { transparent = lib.mkEnableOption "transparent version of flavor"; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + 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 7c849344..523efcc7 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -1,12 +1,19 @@ { catppuccinLib }: { config, lib, ... }: - let - cfg = config.programs.kitty.catppuccin; + cfg = config.catppuccin.kitty; in - { - options.programs.kitty.catppuccin = catppuccinLib.mkCatppuccinOption { name = "kitty"; }; + options.catppuccin.kitty = catppuccinLib.mkCatppuccinOption { name = "kitty"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "kitty" + "catppuccin" + ]; + to = "kitty"; + }; config = lib.mkIf cfg.enable { programs.kitty = { diff --git a/modules/home-manager/kvantum.nix b/modules/home-manager/kvantum.nix index 95ac644f..c0006ceb 100644 --- a/modules/home-manager/kvantum.nix +++ b/modules/home-manager/kvantum.nix @@ -7,7 +7,7 @@ }: let - cfg = config.qt.style.catppuccin; + cfg = config.catppuccin.kvantum; enable = cfg.enable && config.qt.enable; theme = pkgs.catppuccin-kvantum.override { @@ -17,9 +17,8 @@ let themeName = "catppuccin-${cfg.flavor}-${cfg.accent}"; in - { - options.qt.style.catppuccin = + options.catppuccin.kvantum = catppuccinLib.mkCatppuccinOption { name = "Kvantum"; accentSupport = true; @@ -35,6 +34,32 @@ in }; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + 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 c19faaaf..62abeebf 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -9,7 +9,7 @@ let 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 @@ -25,11 +25,21 @@ let in { - options.programs.lazygit.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.lazygit = catppuccinLib.mkCatppuccinOption { name = "lazygit"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "lazygit" + "catppuccin" + ]; + to = "lazygit"; + accentSupport = true; + }; + config = lib.mkIf enable { home.sessionVariables = { # Ensure that the default config file is still sourced diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index a6af6dfb..eaf18867 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -9,7 +9,7 @@ let inherit (config.catppuccin) sources; - cfg = config.services.mako.catppuccin; + cfg = config.catppuccin.mako; theme = catppuccinLib.fromINI ( sources.mako + "/themes/catppuccin-${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}" ); @@ -19,11 +19,21 @@ let in { - options.services.mako.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.mako = catppuccinLib.mkCatppuccinOption { name = "mako"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + 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 cfg.enable { backgroundColor = theme.background-color; diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix index fd16f22d..1c3c5766 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -4,14 +4,23 @@ 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 = catppuccinLib.mkCatppuccinOption { name = "micro"; }; + options.catppuccin.micro = catppuccinLib.mkCatppuccinOption { name = "micro"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "micro" + "catppuccin" + ]; + to = "micro"; + }; config = lib.mkIf enable { programs.micro = { diff --git a/modules/home-manager/mpv.nix b/modules/home-manager/mpv.nix index cb57bb83..cef2c051 100644 --- a/modules/home-manager/mpv.nix +++ b/modules/home-manager/mpv.nix @@ -4,15 +4,25 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.mpv.catppuccin; + cfg = config.catppuccin.mpv; in { - options.programs.mpv.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.mpv = catppuccinLib.mkCatppuccinOption { name = "mpv"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "mpv" + "catppuccin" + ]; + to = "mpv"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { programs.mpv = { config = { diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index fcd01fa8..87b1bd75 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -7,11 +7,20 @@ }: let - cfg = config.programs.neovim.catppuccin; + cfg = config.catppuccin.nvim; in { - options.programs.neovim.catppuccin = catppuccinLib.mkCatppuccinOption { name = "neovim"; }; + options.catppuccin.nvim = catppuccinLib.mkCatppuccinOption { name = "neovim"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "neovim" + "catppuccin" + ]; + to = "nvim"; + }; config = lib.mkIf cfg.enable { programs.neovim = { diff --git a/modules/home-manager/newsboat.nix b/modules/home-manager/newsboat.nix index e75a437d..7092cae9 100644 --- a/modules/home-manager/newsboat.nix +++ b/modules/home-manager/newsboat.nix @@ -4,12 +4,20 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.newsboat.catppuccin; + cfg = config.catppuccin.newsboat; theme = if cfg.flavor == "latte" then "latte" else "dark"; in - { - options.programs.newsboat.catppuccin = catppuccinLib.mkCatppuccinOption { name = "newsboat"; }; + options.catppuccin.newsboat = catppuccinLib.mkCatppuccinOption { name = "newsboat"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "newsboat" + "catppuccin" + ]; + to = "newsboat"; + }; config = lib.mkIf cfg.enable { programs.newsboat = { 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 29c36f54..1b89b5ae 100644 --- a/modules/home-manager/obs-studio.nix +++ b/modules/home-manager/obs.nix @@ -4,14 +4,23 @@ 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_${catppuccinLib.mkUpper cfg.flavor}.ovt"; in { - options.programs.obs-studio.catppuccin = catppuccinLib.mkCatppuccinOption { name = "obs-studio"; }; + options.catppuccin.obs = catppuccinLib.mkCatppuccinOption { name = "obs-studio"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "obs-studio" + "catppuccin" + ]; + to = "obs"; + }; config = lib.mkIf enable { xdg.configFile = { diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index 7de756b1..e3632e1f 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.services.polybar.catppuccin; + cfg = config.catppuccin.polybar; in - { - options.services.polybar.catppuccin = catppuccinLib.mkCatppuccinOption { name = "polybar"; }; + options.catppuccin.polybar = catppuccinLib.mkCatppuccinOption { name = "polybar"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "services" + "polybar" + "catppuccin" + ]; + to = "polybar"; + }; config = lib.mkIf cfg.enable { services.polybar = { diff --git a/modules/home-manager/rio.nix b/modules/home-manager/rio.nix index 708ccfc0..415d4f14 100644 --- a/modules/home-manager/rio.nix +++ b/modules/home-manager/rio.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.rio.catppuccin; + cfg = config.catppuccin.rio; in - { - options.programs.rio.catppuccin = catppuccinLib.mkCatppuccinOption { name = "rio"; }; + options.catppuccin.rio = catppuccinLib.mkCatppuccinOption { name = "rio"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "rio" + "catppuccin" + ]; + to = "rio"; + }; config = lib.mkIf cfg.enable { programs.rio = { diff --git a/modules/home-manager/rofi.nix b/modules/home-manager/rofi.nix index 05ad787e..c0170e90 100644 --- a/modules/home-manager/rofi.nix +++ b/modules/home-manager/rofi.nix @@ -4,11 +4,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 = catppuccinLib.mkCatppuccinOption { name = "rofi"; }; + options.catppuccin.rofi = catppuccinLib.mkCatppuccinOption { name = "rofi"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "rofi" + "catppuccin" + ]; + to = "rofi"; + }; config = lib.mkIf cfg.enable { programs.rofi = { diff --git a/modules/home-manager/skim.nix b/modules/home-manager/skim.nix index 5ca3a8e8..818e5dcc 100644 --- a/modules/home-manager/skim.nix +++ b/modules/home-manager/skim.nix @@ -4,12 +4,21 @@ 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 = catppuccinLib.mkCatppuccinOption { name = "skim"; }; + options.catppuccin.skim = catppuccinLib.mkCatppuccinOption { name = "skim"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "skim" + "catppuccin" + ]; + to = "skim"; + }; config = lib.mkIf cfg.enable { programs.skim = { diff --git a/modules/home-manager/spotify-player.nix b/modules/home-manager/spotify-player.nix index d6ff7185..1fb0620e 100644 --- a/modules/home-manager/spotify-player.nix +++ b/modules/home-manager/spotify-player.nix @@ -4,14 +4,23 @@ 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 = catppuccinLib.mkCatppuccinOption { + options.catppuccin.spotify-player = catppuccinLib.mkCatppuccinOption { name = "spotify-player"; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "spotify-player" + "catppuccin" + ]; + to = "spotify-player"; + }; + config = lib.mkIf cfg.enable { programs.spotify-player = { settings.theme = "Catppuccin-${cfg.flavor}"; diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 30f9d8bf..1362324b 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.starship.catppuccin; + cfg = config.catppuccin.starship; in - { - options.programs.starship.catppuccin = catppuccinLib.mkCatppuccinOption { name = "starship"; }; + options.catppuccin.starship = catppuccinLib.mkCatppuccinOption { name = "starship"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "starship" + "catppuccin" + ]; + to = "starship"; + }; config = lib.mkIf cfg.enable { programs.starship = { diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index 83729bbc..757e7bed 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -4,12 +4,21 @@ let inherit (config.catppuccin) sources; - cfg = config.wayland.windowManager.sway.catppuccin; + cfg = config.catppuccin.sway; theme = "${sources.sway}/themes/catppuccin-${cfg.flavor}"; in - { - options.wayland.windowManager.sway.catppuccin = catppuccinLib.mkCatppuccinOption { name = "sway"; }; + options.catppuccin.sway = catppuccinLib.mkCatppuccinOption { name = "sway"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "wayland" + "windowManager" + "sway" + "catppuccin" + ]; + to = "sway"; + }; config = lib.mkIf cfg.enable { wayland.windowManager.sway = { diff --git a/modules/home-manager/swaylock.nix b/modules/home-manager/swaylock.nix index f1d6cd8f..870db3b1 100644 --- a/modules/home-manager/swaylock.nix +++ b/modules/home-manager/swaylock.nix @@ -1,20 +1,15 @@ { catppuccinLib }: { config, lib, ... }: - let inherit (config.catppuccin) sources; - cfg = config.programs.swaylock.catppuccin; in - { - options.programs.swaylock.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.swaylock = catppuccinLib.mkCatppuccinOption { name = "swaylock"; - /* global `catppuccin.enable` purposefully doesn't work here in configurations with a `home.stateVersion` that is >= 23.05 - this is because the upstream module will automatically enable itself if `programs.swaylock.settings` is set in configurations with a `home.stateVersion` that is < 23.05. so, we can't use the `programs.swaylock.enable` option to guard against defining this like we usually do, as when the @@ -22,7 +17,6 @@ in defining if *our* and the upstream's `enable` option is `true` ...leading to a case of infinite recursion where `programs.swaylock.settings` is only being defined if `programs.swaylock.settings` is defined - debugging this was the most confusing and horrifying thing i've had to deal with throughout working on this project. - @getchoo @@ -30,11 +24,19 @@ in default = lib.versionAtLeast config.home.stateVersion "23.05" && config.catppuccin.enable; defaultText = lib.literalExpression '' `catppuccin.enable` if `home.stateVersion` is >= 23.05, false otherwise - Yes this is weird, and there's a funny story about it in the code comments ''; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "swaylock" + "catppuccin" + ]; + to = "swaylock"; + }; + config = lib.mkIf cfg.enable { programs.swaylock = { settings = catppuccinLib.fromINI (sources.swaylock + "/themes/${cfg.flavor}.conf"); diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index 519dd40e..d994c4c9 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -9,7 +9,7 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.tmux.catppuccin; + cfg = config.catppuccin.tmux; plugin = # TODO @getchoo: upstream this in nixpkgs @@ -21,7 +21,7 @@ let in { - options.programs.tmux.catppuccin = catppuccinLib.mkCatppuccinOption { name = "tmux"; } // { + options.catppuccin.tmux = catppuccinLib.mkCatppuccinOption { name = "tmux"; } // { extraConfig = lib.mkOption { type = lib.types.lines; description = "Additional configuration for the catppuccin plugin."; @@ -32,6 +32,31 @@ in }; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "tmux" + "catppuccin" + ]; + to = "tmux"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "tmux" + "catppuccin" + "extraConfig" + ] + [ + "catppuccin" + "tmux" + "extraConfig" + ] + ) + ]; + config = lib.mkIf cfg.enable { programs.tmux = { plugins = [ diff --git a/modules/home-manager/tofi.nix b/modules/home-manager/tofi.nix index 65e34712..157bc220 100644 --- a/modules/home-manager/tofi.nix +++ b/modules/home-manager/tofi.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.tofi.catppuccin; + cfg = config.catppuccin.tofi; in - { - options.programs.tofi.catppuccin = catppuccinLib.mkCatppuccinOption { name = "tofi"; }; + options.catppuccin.tofi = catppuccinLib.mkCatppuccinOption { name = "tofi"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "tofi" + "catppuccin" + ]; + to = "tofi"; + }; config = lib.mkIf cfg.enable { programs.tofi = { diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix index 626df022..db73b0b4 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -4,14 +4,14 @@ 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 = catppuccinLib.mkCatppuccinOption { name = "waybar"; } // { + options.catppuccin.waybar = catppuccinLib.mkCatppuccinOption { name = "waybar"; } // { mode = lib.mkOption { type = lib.types.enum [ "prependImport" @@ -27,6 +27,31 @@ in }; }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + 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 e25e01cb..f8c2e239 100644 --- a/modules/home-manager/yazi.nix +++ b/modules/home-manager/yazi.nix @@ -4,24 +4,33 @@ 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 = catppuccinLib.mkCatppuccinOption { + options.catppuccin.yazi = catppuccinLib.mkCatppuccinOption { name = "yazi"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + 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 ${catppuccinLib.mkUpper cfg.flavor}.tmTheme"; + "yazi/Catppuccin-${cfg.flavor}.tmTheme".source = "${sources.bat}/themes/Catppuccin ${catppuccinLib.mkUpper cfg.flavor}.tmTheme"; }; }; } diff --git a/modules/home-manager/zathura.nix b/modules/home-manager/zathura.nix index d0d46849..b01b3622 100644 --- a/modules/home-manager/zathura.nix +++ b/modules/home-manager/zathura.nix @@ -4,11 +4,19 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.zathura.catppuccin; + cfg = config.catppuccin.zathura; in - { - options.programs.zathura.catppuccin = catppuccinLib.mkCatppuccinOption { name = "zathura"; }; + options.catppuccin.zathura = catppuccinLib.mkCatppuccinOption { name = "zathura"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "zathura" + "catppuccin" + ]; + to = "zathura"; + }; config = lib.mkIf cfg.enable { programs.zathura = { diff --git a/modules/home-manager/zellij.nix b/modules/home-manager/zellij.nix index efd0e11a..4c1e586b 100644 --- a/modules/home-manager/zellij.nix +++ b/modules/home-manager/zellij.nix @@ -2,17 +2,24 @@ { config, lib, ... }: let - cfg = config.programs.zellij.catppuccin; + cfg = config.catppuccin.zellij; themeName = "catppuccin-${cfg.flavor}"; in - { - options.programs.zellij.catppuccin = catppuccinLib.mkCatppuccinOption { name = "zellij"; }; + options.catppuccin.zellij = catppuccinLib.mkCatppuccinOption { name = "zellij"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "zellij" + "catppuccin" + ]; + to = "zellij"; + }; config = lib.mkIf cfg.enable { programs.zellij = { settings = { - theme = themeName; }; }; diff --git a/modules/home-manager/zsh-syntax-highlighting.nix b/modules/home-manager/zsh-syntax-highlighting.nix index ec417f1a..6ddc38d0 100644 --- a/modules/home-manager/zsh-syntax-highlighting.nix +++ b/modules/home-manager/zsh-syntax-highlighting.nix @@ -4,20 +4,70 @@ let inherit (config.catppuccin) sources; - cfg = config.programs.zsh.syntaxHighlighting.catppuccin; - enable = cfg.enable && config.programs.zsh.syntaxHighlighting.enable; + cfg = config.catppuccin.zsh-syntax-highlighting; + oldCfg = config.programs.zsh.syntaxHighlighting.catppuccin; + + isSubmoduleOptionDefined = value: (builtins.tryEval value).success; in { - options.programs.zsh.syntaxHighlighting.catppuccin = catppuccinLib.mkCatppuccinOption { - name = "Zsh Syntax Highlighting"; - }; + options = { + catppuccin.zsh-syntax-highlighting = catppuccinLib.mkCatppuccinOption { + name = "Zsh Syntax Highlighting"; + }; + + # `mkRenamedOptionModule` can't rename submodule options to top-level ones + # Enter this nonsense + # TODO: Abstract this + + # Extend the base submodule with our own options + programs.zsh.syntaxHighlighting = { + # Create options manually as `mkRenamedOptionModule` would + catppuccin = { + # But don't include the `trace` to each option since we do need to + # check them with `isSubmoduleOptionDefined` + enable = lib.mkOption { + type = lib.types.bool; + description = "Alias of `catppuccin.zsh-syntax-highlighting.enable`"; + visible = false; + }; - config = lib.mkIf enable { - programs.zsh = { - initExtra = lib.mkBefore '' - source '${sources.zsh-syntax-highlighting}/themes/catppuccin_${cfg.flavor}-zsh-syntax-highlighting.zsh' - ''; + flavor = lib.mkOption { + type = catppuccinLib.types.flavor; + description = "Alias of `catppuccin.zsh-syntax-highlighting.flavor`"; + visible = false; + }; + }; }; }; + + config = lib.mkMerge [ + (lib.mkIf (isSubmoduleOptionDefined oldCfg.enable) { + # Place the warning, also like `mkRenamedOptionModule` normally would + warnings = [ + "The option `programs.zsh.syntaxHighlighting.catppuccin.enable` has been renamed to `catppuccin.zsh-syntax-highlighting.enable`." + ]; + + # Actually alias the option + catppuccin.zsh-syntax-highlighting.enable = oldCfg.enable; + }) + + # Do it again for the flavor + (lib.mkIf (isSubmoduleOptionDefined oldCfg.flavor) { + warnings = [ + "The option `programs.zsh.syntaxHighlighting.catppuccin.flavor` has been renamed to `catppuccin.zsh-syntax-highlighting.flavor`." + ]; + + catppuccin.zsh-syntax-highlighting.flavor = oldCfg.flavor; + }) + + # And this is our actual module + (lib.mkIf cfg.enable { + programs.zsh = { + initExtra = lib.mkBefore '' + source '${sources.zsh-syntax-highlighting}/themes/catppuccin_${cfg.flavor}-zsh-syntax-highlighting.zsh' + ''; + }; + }) + ]; } diff --git a/modules/lib/default.nix b/modules/lib/default.nix index b5ee4d05..d5d2ee56 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -154,4 +154,56 @@ lib.makeExtensible (ctp: { # [ module ] -> [ module ] # Imports a list of modules with the current library applyToModules = map (lib.flip lib.modules.importApply { catppuccinLib = ctp; }); + + # a -> list + # this is used to make old modules to new modules + mkRenamedCatppuccinOptions = + { + 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 d72be7c3..5fd61fce 100644 --- a/modules/nixos/all-modules.nix +++ b/modules/nixos/all-modules.nix @@ -1,7 +1,7 @@ [ - ./console.nix ./fcitx5.nix ./grub.nix ./plymouth.nix ./sddm.nix + ./tty.nix ] diff --git a/modules/nixos/fcitx5.nix b/modules/nixos/fcitx5.nix index 6b659625..3721ca6f 100644 --- a/modules/nixos/fcitx5.nix +++ b/modules/nixos/fcitx5.nix @@ -9,7 +9,7 @@ let inherit (config.catppuccin) sources; - cfg = config.i18n.inputMethod.fcitx5.catppuccin; + cfg = config.catppuccin.fcitx5; theme = pkgs.runCommand "catppuccin-fcitx5" { } '' mkdir -p $out/share/fcitx5/themes/ @@ -18,11 +18,22 @@ let in { - options.i18n.inputMethod.fcitx5.catppuccin = catppuccinLib.mkCatppuccinOption { + options.catppuccin.fcitx5 = catppuccinLib.mkCatppuccinOption { name = "Fcitx5"; accentSupport = true; }; + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "i18n" + "inputMethod" + "fcitx5" + "catppuccin" + ]; + to = "fcitx5"; + accentSupport = true; + }; + config = lib.mkIf cfg.enable { i18n.inputMethod.fcitx5 = { addons = [ theme ]; diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 50feb199..f709d789 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -9,7 +9,7 @@ let inherit (config.catppuccin) sources; - cfg = config.boot.loader.grub.catppuccin; + cfg = config.catppuccin.grub; # TODO @getchoo: upstream this in nixpkgs maybe? idk if they have grub themes theme = pkgs.runCommand "catppuccin-grub-theme" { } '' @@ -17,9 +17,18 @@ let cp -r ${sources.grub}/src/catppuccin-${cfg.flavor}-grub-theme/* "$out"/ ''; in - { - options.boot.loader.grub.catppuccin = catppuccinLib.mkCatppuccinOption { name = "grub"; }; + options.catppuccin.grub = catppuccinLib.mkCatppuccinOption { name = "grub"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "boot" + "loader" + "grub" + "catppuccin" + ]; + to = "grub"; + }; config = lib.mkIf cfg.enable { boot.loader.grub = { diff --git a/modules/nixos/plymouth.nix b/modules/nixos/plymouth.nix index d191e3a9..69cd1517 100644 --- a/modules/nixos/plymouth.nix +++ b/modules/nixos/plymouth.nix @@ -5,13 +5,20 @@ lib, ... }: - let - cfg = config.boot.plymouth.catppuccin; + cfg = config.catppuccin.plymouth; in - { - options.boot.plymouth.catppuccin = catppuccinLib.mkCatppuccinOption { name = "plymouth"; }; + options.catppuccin.plymouth = catppuccinLib.mkCatppuccinOption { name = "plymouth"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "boot" + "plymouth" + "catppuccin" + ]; + to = "plymouth"; + }; config = lib.mkIf cfg.enable { boot.plymouth = { diff --git a/modules/nixos/sddm.nix b/modules/nixos/sddm.nix index c1af1898..4bcda3dc 100644 --- a/modules/nixos/sddm.nix +++ b/modules/nixos/sddm.nix @@ -12,48 +12,132 @@ let types ; - cfg = config.services.displayManager.sddm.catppuccin; + cfg = config.catppuccin.sddm; enable = cfg.enable && config.services.displayManager.sddm.enable; in - { - options.services.displayManager.sddm.catppuccin = - catppuccinLib.mkCatppuccinOption { name = "sddm"; } - // { - font = mkOption { - type = types.str; - default = "Noto Sans"; - description = "Font to use for the login screen"; - }; + options.catppuccin.sddm = catppuccinLib.mkCatppuccinOption { name = "sddm"; } // { + font = mkOption { + type = types.str; + default = "Noto Sans"; + description = "Font to use for the login screen"; + }; - fontSize = mkOption { - type = types.str; - default = "9"; - description = "Font size to use for the login screen"; - }; + fontSize = mkOption { + type = types.str; + default = "9"; + description = "Font size to use for the login screen"; + }; - background = mkOption { - type = with types; (either path str); - default = ""; - description = "Background image to use for the login screen"; - }; + background = mkOption { + type = with types; (either path str); + default = ""; + description = "Background image to use for the login screen"; + }; + + loginBackground = mkOption { + type = types.bool; + default = true; + description = "Add an additional background layer to the login panel"; + }; + + assertQt6Sddm = + lib.mkEnableOption '' + checking if `services.displayManager.sddm.package` is the Qt 6 version. - loginBackground = mkOption { - type = types.bool; + This is to ensure the theme is applied properly, but may have false positives in the case of overridden packages for example + '' + // { default = true; - description = "Add an additional background layer to the login panel"; }; + }; - assertQt6Sddm = - lib.mkEnableOption '' - checking if `services.displayManager.sddm.package` is the Qt 6 version. + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "services" + "displayManager" + "sddm" + "catppuccin" + ]; + to = "sddm"; + }) + ++ [ + (lib.mkRenamedOptionModule + [ + "services" + "displayManager" + "sddm" + "catppuccin" + "font" + ] + [ + "catppuccin" + "sddm" + "font" + ] + ) - This is to ensure the theme is applied properly, but may have false positives in the case of overridden packages for example - '' - // { - default = true; - }; - }; + (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 = lib.mkIf enable { assertions = lib.optional cfg.assertQt6Sddm { diff --git a/modules/nixos/console.nix b/modules/nixos/tty.nix similarity index 73% rename from modules/nixos/console.nix rename to modules/nixos/tty.nix index f43787bc..5459f82b 100644 --- a/modules/nixos/console.nix +++ b/modules/nixos/tty.nix @@ -4,14 +4,20 @@ 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 = catppuccinLib.mkCatppuccinOption { name = "console"; }; + options.catppuccin.tty = catppuccinLib.mkCatppuccinOption { name = "console"; }; + + imports = catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "console" + "catppuccin" + ]; + to = "tty"; + }; config = lib.mkIf enable { # Manually populate with colors from catppuccin/tty