Skip to content

Commit

Permalink
feat(modules): move to catppuccin namespace (#371)
Browse files Browse the repository at this point in the history
Co-authored-by: Weathercold <[email protected]>
Co-authored-by: seth <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent 5cdefd6 commit 20c0cb2
Show file tree
Hide file tree
Showing 57 changed files with 1,019 additions and 232 deletions.
2 changes: 1 addition & 1 deletion docs/mk-search.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 11 additions & 4 deletions modules/home-manager/aerc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
15 changes: 11 additions & 4 deletions modules/home-manager/alacritty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions modules/home-manager/all-modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
./bottom.nix
./btop.nix
./cava.nix
./cursor.nix
./cursors.nix
./delta.nix
./dunst.nix
./fcitx5.nix
Expand Down Expand Up @@ -41,7 +41,7 @@
./sway.nix
./tmux.nix
./tofi.nix
./obs-studio.nix
./obs.nix
./waybar.nix
./yazi.nix
./zathura.nix
Expand Down
15 changes: 11 additions & 4 deletions modules/home-manager/bat.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
15 changes: 11 additions & 4 deletions modules/home-manager/bottom.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
13 changes: 11 additions & 2 deletions modules/home-manager/btop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 = {
Expand Down
30 changes: 27 additions & 3 deletions modules/home-manager/cava.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand All @@ -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";
Expand Down
14 changes: 12 additions & 2 deletions modules/home-manager/delta.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
29 changes: 27 additions & 2 deletions modules/home-manager/dunst.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,44 @@
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";
description = "Prefix to use for the dunst drop-in file";
};
};

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.
Expand Down
32 changes: 30 additions & 2 deletions modules/home-manager/fcitx5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}" = {
Expand Down
13 changes: 11 additions & 2 deletions modules/home-manager/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
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}";
themePath = "/themes/${themeName}.theme";
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}";
Expand Down
Loading

0 comments on commit 20c0cb2

Please sign in to comment.