Skip to content

Commit

Permalink
feat(modules)!: flavour -> flavor (catppuccin#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed May 22, 2024
1 parent ac87622 commit fea5242
Show file tree
Hide file tree
Showing 48 changed files with 101 additions and 111 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## Adding a port

Create a file in `modules/<module>/` with the name of the port. All ports should have
the `catppuccin.enable` and `catppuccin.flavour` options, and optionally the
`catppuccin.accent` option. `catppuccin.flavour` and `catppuccin.accent` should
default to `config.catppuccin.flavour` and `config.catppuccin.accent`, respectively.
the `catppuccin.enable` and `catppuccin.flavor` options, and optionally the
`catppuccin.accent` option. `catppuccin.flavor` and `catppuccin.accent` should
default to `config.catppuccin.flavor` and `config.catppuccin.accent`, respectively.

[npins](https://github.com/andir/npins) is used to track our upstream
sources to use in modules. This allows us to easily access and auto-update all themes.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ For [standalone installations](https://nix-community.github.io/home-manager/inde

</details>

2. Choose your desired flavour with `catppuccin.flavour`
2. Choose your desired flavor with `catppuccin.flavor`

```nix
{
catppuccin.flavour = "mocha";
catppuccin.flavor = "mocha";
}
```

Expand Down
5 changes: 2 additions & 3 deletions modules/home-manager/alacritty.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{ config, lib, ... }:
let
inherit (lib) ctp;
inherit (config.catppuccin) sources;
cfg = config.programs.alacritty.catppuccin;
enable = cfg.enable && config.programs.alacritty.enable;
in
{
options.programs.alacritty.catppuccin = ctp.mkCatppuccinOpt "alacritty";
options.programs.alacritty.catppuccin = lib.ctp.mkCatppuccinOpt "alacritty";

config = lib.mkIf enable {
programs.alacritty.settings = lib.importTOML "${sources.alacritty}/catppuccin-${cfg.flavour}.toml";
programs.alacritty.settings = lib.importTOML "${sources.alacritty}/catppuccin-${cfg.flavor}.toml";
};
}
2 changes: 1 addition & 1 deletion modules/home-manager/bat.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let
inherit (config.catppuccin) sources;
cfg = config.programs.bat.catppuccin;
enable = cfg.enable && config.programs.bat.enable;
themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavour}";
themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavor}";
in
{
options.programs.bat.catppuccin = lib.ctp.mkCatppuccinOpt "bat";
Expand Down
4 changes: 1 addition & 3 deletions modules/home-manager/bottom.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ in
options.programs.bottom.catppuccin = lib.ctp.mkCatppuccinOpt "bottom";

config = lib.mkIf enable {

programs.bottom = {

settings = builtins.fromTOML (builtins.readFile "${sources.bottom}/themes/${cfg.flavour}.toml");
settings = lib.importTOML "${sources.bottom}/themes/${cfg.flavor}.toml";
};
};
}
2 changes: 1 addition & 1 deletion modules/home-manager/btop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let
cfg = config.programs.btop.catppuccin;
enable = cfg.enable && config.programs.btop.enable;

themeFile = "catppuccin_${cfg.flavour}.theme";
themeFile = "catppuccin_${cfg.flavor}.theme";
themePath = "/themes/${themeFile}";
theme = sources.btop + themePath;
in
Expand Down
4 changes: 1 addition & 3 deletions modules/home-manager/cava.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{ config, lib, ... }:
let
inherit (lib) ctp;
inherit (config.catppuccin) sources;

cfg = config.programs.cava.catppuccin;
enable = cfg.enable && config.programs.cava.enable;
in
{
options.programs.cava.catppuccin = lib.ctp.mkCatppuccinOpt "cava";

config.programs.cava = lib.mkIf enable {
settings = lib.ctp.fromINIRaw (sources.cava + /themes/${cfg.flavour}.cava);
settings = lib.ctp.fromINIRaw (sources.cava + "/themes/${cfg.flavor}.cava");
};
}
2 changes: 1 addition & 1 deletion modules/home-manager/delta.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ in
config = lib.mkIf enable {
programs.git = {
includes = [ { path = "${sources.delta}/catppuccin.gitconfig"; } ];
delta.options.features = "catppuccin-${cfg.flavour}";
delta.options.features = "catppuccin-${cfg.flavor}";
};
};
}
3 changes: 1 addition & 2 deletions modules/home-manager/dunst.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{ config, lib, ... }:
let
inherit (config.catppuccin) sources;

cfg = config.services.dunst.catppuccin;
enable = cfg.enable && config.services.dunst.enable;
in
{
options.services.dunst.catppuccin = lib.ctp.mkCatppuccinOpt "dunst";

config.services.dunst = lib.mkIf enable {
settings = lib.ctp.fromINI (sources.dunst + /themes/${cfg.flavour}.conf);
settings = lib.ctp.fromINI (sources.dunst + "/themes/${cfg.flavor}.conf");
};
}
6 changes: 3 additions & 3 deletions modules/home-manager/fcitx5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ in
};

config = lib.mkIf enable {
xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavour}" = {
source = "${sources.fcitx5}/src/catppuccin-${cfg.flavour}";
xdg.dataFile."fcitx5/themes/catppuccin-${cfg.flavor}" = {
source = "${sources.fcitx5}/src/catppuccin-${cfg.flavor}";
recursive = true;
};

xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply {
text = lib.generators.toINIWithGlobalSection { } {
globalSection.Theme = "catppuccin-${cfg.flavour}";
globalSection.Theme = "catppuccin-${cfg.flavor}";
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let
cfg = config.programs.fish.catppuccin;
enable = cfg.enable && config.programs.fish.enable;

themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavour}";
themeName = "Catppuccin ${lib.ctp.mkUpper cfg.flavor}";
themePath = "/themes/${themeName}.theme";
in
{
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/foot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let

cfg = config.programs.foot.catppuccin;
enable = cfg.enable && config.programs.foot.enable;
theme = lib.ctp.fromINI (sources.foot + "/themes/catppuccin-${cfg.flavour}.ini");
theme = lib.ctp.fromINI (sources.foot + "/themes/catppuccin-${cfg.flavor}.ini");
in
{
options.programs.foot.catppuccin = lib.ctp.mkCatppuccinOpt "foot";
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/fzf.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let

cfg = config.programs.fzf.catppuccin;
enable = cfg.enable && config.programs.fzf.enable;
palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavour}.colors;
palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors;
in
{
options.programs.fzf.catppuccin = lib.ctp.mkCatppuccinOpt "fzf";
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/gh-dash.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let
inherit (config.catppuccin) sources;
cfg = config.programs.gh-dash.catppuccin;
enable = cfg.enable && config.programs.gh-dash.enable;
theme = "${sources.gh-dash}/themes/${cfg.flavour}/catppuccin-${cfg.flavour}-${cfg.accent}.yml";
theme = "${sources.gh-dash}/themes/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml";
in
{
options.programs.gh-dash.catppuccin = lib.ctp.mkCatppuccinOpt "gh-dash" // {
Expand Down
4 changes: 2 additions & 2 deletions modules/home-manager/gitui.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ in

config = lib.mkIf enable {
programs.gitui.theme = builtins.path {
name = "${cfg.flavour}.ron";
path = "${sources.gitui}/theme/${cfg.flavour}.ron";
name = "${cfg.flavor}.ron";
path = "${sources.gitui}/theme/${cfg.flavor}.ron";
};
};
}
2 changes: 1 addition & 1 deletion modules/home-manager/glamour.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ in

config = {
home.sessionVariables = lib.mkIf enable {
GLAMOUR_STYLE = "${sources.glamour}/themes/catppuccin-${cfg.flavour}.json";
GLAMOUR_STYLE = "${sources.glamour}/themes/catppuccin-${cfg.flavor}.json";
};
};
}
6 changes: 3 additions & 3 deletions modules/home-manager/globals.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
options.catppuccin = {
enable = lib.mkEnableOption "Catppuccin globally";

flavour = lib.mkOption {
type = lib.ctp.types.flavourOption;
flavor = lib.mkOption {
type = lib.ctp.types.flavorOption;
default = "mocha";
description = "Global Catppuccin flavour";
description = "Global Catppuccin flavor";
};

accent = lib.mkOption {
Expand Down
23 changes: 10 additions & 13 deletions modules/home-manager/gtk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,40 @@ in
gtk = {
theme =
let
flavourUpper = ctp.mkUpper cfg.flavour;
flavorUpper = ctp.mkUpper cfg.flavor;
accentUpper = ctp.mkUpper cfg.accent;
sizeUpper = ctp.mkUpper cfg.size;

# use the light gtk theme for latte
gtkTheme = if cfg.flavour == "latte" then "Light" else "Dark";
gtkTheme = if cfg.flavor == "latte" then "Light" else "Dark";
in
{
name = "Catppuccin-${flavourUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}";
name = "Catppuccin-${flavorUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}";
package = pkgs.catppuccin-gtk.override {
inherit (cfg) size tweaks;
accents = [ cfg.accent ];
variant = cfg.flavour;
variant = cfg.flavor;
};
};

cursorTheme =
let
flavourUpper = ctp.mkUpper cfg.cursor.flavour;
flavorUpper = ctp.mkUpper cfg.cursor.flavor;
accentUpper = ctp.mkUpper cfg.cursor.accent;
in
lib.mkIf cfg.cursor.enable {
name = "Catppuccin-${flavourUpper}-${accentUpper}-Cursors";
package = pkgs.catppuccin-cursors.${cfg.cursor.flavour + accentUpper};
name = "Catppuccin-${flavorUpper}-${accentUpper}-Cursors";
package = pkgs.catppuccin-cursors.${cfg.cursor.flavor + accentUpper};
};

iconTheme =
let
# use the light icon theme for latte
polarity = if cfg.icon.flavour == "latte" then "Light" else "Dark";
polarity = if cfg.icon.flavor == "latte" then "Light" else "Dark";
in
lib.mkIf cfg.icon.enable {
name = "Papirus-${polarity}";
package = pkgs.catppuccin-papirus-folders.override {
flavor = cfg.icon.flavour;
inherit (cfg.icon) accent;
};
package = pkgs.catppuccin-papirus-folders.override { inherit (cfg.icon) accent flavor; };
};
};

Expand All @@ -119,7 +116,7 @@ in
inherit (config.gtk.theme) name;
};
"org/gnome/desktop/interface" = {
color-scheme = if cfg.flavour == "latte" then "default" else "prefer-dark";
color-scheme = if cfg.flavor == "latte" then "default" else "prefer-dark";
};
};
};
Expand Down
35 changes: 16 additions & 19 deletions modules/home-manager/helix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,22 @@ let
enable = cfg.enable && config.programs.helix.enable;
in
{
options.programs.helix.catppuccin =
with lib;
ctp.mkCatppuccinOpt "helix"
// {
useItalics = mkEnableOption "Italics in Catppuccin theme for Helix";
};
options.programs.helix.catppuccin = lib.ctp.mkCatppuccinOpt "helix" // {
useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix";
};

config.programs.helix =
let
subdir = if cfg.useItalics then "default" else "no_italics";
in
lib.mkIf enable {
settings = {
theme = "catppuccin-${cfg.flavour}";
editor.color-modes = lib.mkDefault true;
};
config = lib.mkIf enable {
programs.helix =
let
subdir = if cfg.useItalics then "default" else "no_italics";
in
{
settings = {
theme = "catppuccin-${cfg.flavor}";
editor.color-modes = lib.mkDefault true;
};

themes."catppuccin-${cfg.flavour}" = builtins.fromTOML (
builtins.readFile "${sources.helix}/themes/${subdir}/catppuccin_${cfg.flavour}.toml"
);
};
themes."catppuccin-${cfg.flavor}" = lib.importTOML "${sources.helix}/themes/${subdir}/catppuccin_${cfg.flavor}.toml";
};
};
}
2 changes: 1 addition & 1 deletion modules/home-manager/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ in

config.wayland.windowManager.hyprland.settings = lib.mkIf enable {
source = [
"${sources.hyprland}/themes/${cfg.flavour}.conf"
"${sources.hyprland}/themes/${cfg.flavor}.conf"
(builtins.toFile "hyprland-${cfg.accent}-accent.conf" ''
$accent=''$${cfg.accent}
$accentAlpha=''$${cfg.accent}Alpha
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/imv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ in
options.programs.imv.catppuccin = lib.ctp.mkCatppuccinOpt "imv";

config.programs.imv.settings = lib.mkIf enable (
lib.ctp.fromINI (sources.imv + /themes/${cfg.flavour}.config)
lib.ctp.fromINI (sources.imv + "/themes/${cfg.flavor}.config")
);
}
4 changes: 2 additions & 2 deletions modules/home-manager/k9s.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ let
cfg = config.programs.k9s.catppuccin;
enable = cfg.enable && config.programs.k9s.enable;

themeName = "catppuccin-${cfg.flavour}" + lib.optionalString cfg.transparent "-transparent";
themeName = "catppuccin-${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent";
themeFile = "${themeName}.yaml";
themePath = "/skins/${themeFile}";
theme = sources.k9s + "/dist/${themeFile}";
in
{
options.programs.k9s.catppuccin = lib.ctp.mkCatppuccinOpt "k9s" // {
transparent = lib.mkEnableOption "transparent version of flavour";
transparent = lib.mkEnableOption "transparent version of flavor";
};

config = lib.mkIf enable {
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/kitty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ in
{
options.programs.kitty.catppuccin = ctp.mkCatppuccinOpt "kitty";

config.programs.kitty = lib.mkIf enable { theme = "Catppuccin-${ctp.mkUpper cfg.flavour}"; };
config.programs.kitty = lib.mkIf enable { theme = "Catppuccin-${ctp.mkUpper cfg.flavor}"; };
}
2 changes: 1 addition & 1 deletion modules/home-manager/lazygit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let
cfg = config.programs.lazygit.catppuccin;
enable = cfg.enable && config.programs.lazygit.enable;

themePath = "/${cfg.flavour}/${cfg.accent}.yml";
themePath = "/${cfg.flavor}/${cfg.accent}.yml";
in
{
options.programs.lazygit.catppuccin = lib.ctp.mkCatppuccinOpt "lazygit" // {
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/mako.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
inherit (config.catppuccin) sources;
cfg = config.services.mako.catppuccin;
enable = cfg.enable && config.services.mako.enable;
theme = lib.ctp.fromINI (sources.mako + /src/${cfg.flavour});
theme = lib.ctp.fromINI (sources.mako + "/src/${cfg.flavor}");

# Settings that need to be extracted and put in extraConfig
extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme;
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/micro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let
cfg = config.programs.micro.catppuccin;
enable = cfg.enable && config.programs.micro.enable;

themePath = "catppuccin-${cfg.flavour}.micro";
themePath = "catppuccin-${cfg.flavor}.micro";
in
{
options.programs.micro.catppuccin = lib.ctp.mkCatppuccinOpt "micro";
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/mpv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let
inherit (config.catppuccin) sources;
cfg = config.programs.mpv.catppuccin;
enable = cfg.enable && config.programs.mpv.enable;
themeDir = sources.mpv + /themes/${cfg.flavour}/${cfg.accent};
themeDir = sources.mpv + "/themes/${cfg.flavor}/${cfg.accent}";
in
{
options.programs.mpv.catppuccin = lib.ctp.mkCatppuccinOpt "mpv" // {
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/neovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ in
require("catppuccin").setup({
compile_path = compile_path,
flavour = "${cfg.flavour}",
flavour = "${cfg.flavor}",
})
vim.api.nvim_command("colorscheme catppuccin")
Expand Down
Loading

0 comments on commit fea5242

Please sign in to comment.