-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
{ config, lib, pkgs, ... }:
let
cfg = config.themes.catppuccin;
in
{
options = {
themes.catppuccin.flavor = lib.mkOption {
type = lib.types.enum [
"latte"
"frappe"
"macchiato"
"mocha"
];
default = "mocha";
description = ''
Specify which Catppuccin _flavor_ (color palette) to use.
'';
};
};
config =
let
json = builtins.fromJSON (builtins.readFile (
pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "palette";
rev = "205dd54c6158b7648621cf9fd00e91f03888ce7e";
sha256 = "y14fd8lvnG9hNY6CRU0JgxWouexEw91aIEMkr1NaM/4=";
}
+ "/palette.json"
));
flavor = json."${cfg.flavor}";
in
{
features.basics.zsh.theme =
let
zshFg = hex: "%F{${hex}}";
in
{
text = zshFg flavor.text.hex;
vi.insert = zshFg flavor.blue.hex;
vi.normal = zshFg flavor.green.hex;
vcs.info = zshFg flavor.subtext0.hex;
vcs.staged = zshFg flavor.green.hex;
vcs.unstaged = zshFg flavor.red.hex;
symbol = zshFg flavor.overlay0.hex;
};
# Only a subset of configurable knobs... Nushell's docs and API stability is unbelievably bad.
features.data.nushell = lib.mkIf (config.features.data.enable && config.programs.nushell.enable) {
colorConfig = {
separator = flavor.subtext1.hex;
leading_trailing_space_bg = flavor.mantle.hex;
header = flavor.green.hex;
row_index = flavor.pink.hex;
hints = flavor.subtext0.hex;
date = flavor.maroon.hex;
string = flavor.text.hex;
bool = flavor.peach.hex;
int = flavor.peach.hex;
float = flavor.peach.hex;
shape_bool = flavor.peach.hex;
shape_string = flavor.green.hex;
shape_int = flavor.peach.hex;
shape_float = flavor.peach.hex;
};
};
home.packages = [
# A generator for LS_COLORS with support for multiple color themes
# https://github.com/sharkdp/vivid
pkgs.vivid
];
# Colourise exa, ls, lf, etc...
# This needs to be done in .zshrc: in Crostini, `home.sessionVariables`
# cannot invoke `vivid` binary. Probably evaluation timing?
programs.zsh.initExtra = ''
export LS_COLORS="$(vivid generate catppuccin-${cfg.flavor})"
'';
programs.bat = lib.mkIf config.programs.bat.enable {
themes = {
"catppuccin-${cfg.flavor}" = builtins.readFile (
pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "bat";
rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1";
sha256 = "1g2r6j33f4zys853i1c5gnwcdbwb6xv5w6pazfdslxf69904lrg9";
}
+ "/Catppuccin-${cfg.flavor}.tmTheme"
);
};
config = {
theme = "catppuccin-${cfg.flavor}";
};
};
programs.tmux.plugins = [
{
plugin = pkgs.tmuxPlugins.catppuccin;
extraConfig = ''
set -g @plugin 'catppuccin/tmux'
set -g @catppuccin_flavour '${cfg.flavor}'
set -g @catppuccin_no_patched_fonts_theme_enabled on
'';
}
];
programs.neovim =
{
plugins =
[
{
plugin = pkgs.vimPlugins.catppuccin-nvim;
type = "lua";
config =
let
lspIntegration = lib.trivial.boolToString config.features.dev.lsp.enable;
in
''
vim.o.termguicolors = true
require("catppuccin").setup({
flavour = "${cfg.flavor}",
transparent_background = true,
integrations = {
indent_blankline = {
enabled = true,
},
cmp = ${lspIntegration},
lsp_trouble = ${lspIntegration},
},
})
vim.cmd.colorscheme "catppuccin"
'';
}
];
};
programs.kitty =
let
# Convert the input string's first character to upper case.
# Example: "foo" -> "Foo"
toCapital = with lib;
str:
let
len = builtins.stringLength str;
head = strings.toUpper (builtins.substring 0 1 str);
tail = builtins.substring 1 (len - 1) str;
in
head + tail;
in
{
theme = "Catppuccin-${toCapital cfg.flavor}";
};
programs.foot =
let
toFootHex = lib.strings.removePrefix "#";
fg = toFootHex flavor.surface0.hex;
bg = toFootHex flavor.text.hex;
in
{
settings.main = {
include = "${config.xdg.configHome}/foot/theme.conf";
};
settings.cursor = {
# Foot by default invert fg/bg for cursor. However, this makes
# cursor on indent_blankline's indent char/spaces barely visible.
color = "${fg} ${bg}";
};
};
xdg.configFile."foot/theme.conf" = lib.mkIf config.programs.foot.enable {
text = builtins.readFile (
pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "foot";
rev = "009cd57bd3491c65bb718a269951719f94224eb7";
sha256 = "0f0r8d4rn54gibrzfhiy4yr8bi7c8j18ggp1y9lyidc1dmy9kvw0";
}
+ "/catppuccin-${cfg.flavor}.conf"
);
};
};
}