-
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
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
-
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
-
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
-
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
-
480
-
481
-
482
-
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
-
499
-
500
-
501
-
502
-
503
-
504
-
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
-
514
{ 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.
'';
};
wallpaperWidth = lib.mkOption {
type = lib.types.ints.unsigned;
default = 3840;
};
wallpaperHeight = lib.mkOption {
type = lib.types.ints.unsigned;
default = 2160;
};
};
};
config =
let
json = builtins.fromJSON (builtins.readFile (
pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "palette";
rev = "205dd54c6158b7648621cf9fd00e91f03888ce7e";
sha256 = "y14fd8lvnG9hNY6CRU0JgxWouexEw91aIEMkr1NaM/4=";
}
+ "/palette.json"
));
flavor = json."${cfg.flavor}";
wallpaper = import ./wallpaper {
inherit pkgs;
flavor = cfg.flavor;
colors = flavor;
mocha = json.mocha;
width = cfg.wallpaperWidth;
height = cfg.wallpaperHeight;
};
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;
};
};
features.wayland-de = lib.mkIf config.features.wayland-de.enable {
tofi = rec {
fuzzyMatch = false;
font = {
family = "Dank Mono";
size = 11;
};
scale = true;
anchor = "bottom";
horizontal = true;
# "100%" does not work on fractional scaling display
# https://github.com/philj56/tofi/issues/79
width = 0;
height = font.size + padding.top + padding.bottom + selection.backgroundPadding.top + selection.backgroundPadding.bottom + border.width * 2;
resultSpacing = 10 + selection.backgroundPadding.left + selection.backgroundPadding.right;
# Avoid unwanted clipping
# https://github.com/philj56/tofi/issues/65#issuecomment-1335556041
clipToPadding = false;
padding = {
top = 6;
right = 8;
# There is no way to specify line-height: need to adjust padding-bottom or something.
bottom = 5;
left = 8;
};
prompt = {
text = ">";
background = "#00000000";
color = flavor.teal.hex;
padding = 8;
};
input = {
color = flavor.subtext0.hex;
backgroundPadding = {
top = 0;
right = 32;
bottom = 0;
left = 0;
};
};
selection = {
background = flavor.surface2.hex + "66";
color = flavor.text.hex;
matchColor = flavor.peach.hex;
backgroundPadding = {
top = 4;
right = 8;
bottom = 4;
left = 8;
};
backgroundCornerRadius = 4;
};
textColor = flavor.text.hex;
backgroundColor = flavor.mantle.hex;
outline = {
width = 0;
color = "#00000000";
};
border = {
width = 0;
color = "#00000000";
};
};
swaybg = {
background = flavor.base.hex;
image = "${wallpaper}/usr/share/backgrounds/catppuccin-${cfg.flavor}.png";
};
};
services.dunst = lib.mkIf config.services.dunst.enable {
settings = {
global = {
width = 400;
height = 300;
offset = "4x4";
padding = 4;
horizontal_padding = 8;
frame_width = 2;
gap_size = 6;
font = "Monospace 10";
corner_radius = 2;
};
urgency_low = {
background = flavor.base.hex;
foreground = flavor.subtext0.hex;
frame_color = flavor.overlay1.hex;
};
urgency_normal = {
background = flavor.base.hex;
foreground = flavor.text.hex;
frame_color = flavor.blue.hex;
};
urgency_critical = {
background = flavor.base.hex;
foreground = flavor.text.hex;
frame_color = flavor.yellow.hex;
};
};
};
home.packages = [
# A generator for LS_COLORS with support for multiple color themes
# https://github.com/sharkdp/vivid
pkgs.vivid
(lib.mkIf config.features.wayland-de.enable wallpaper)
];
wayland.windowManager.sway = lib.mkIf config.wayland.windowManager.sway.enable {
config = {
colors = {
focused = {
childBorder = flavor.lavender.hex;
background = flavor.base.hex;
text = flavor.text.hex;
indicator = flavor.rosewater.hex;
border = flavor.lavender.hex;
};
focusedInactive = {
childBorder = flavor.overlay0.hex;
background = flavor.base.hex;
text = flavor.overlay1.hex;
indicator = flavor.rosewater.hex;
border = flavor.overlay0.hex;
};
unfocused = {
childBorder = flavor.overlay0.hex;
background = flavor.base.hex;
text = flavor.overlay1.hex;
indicator = flavor.rosewater.hex;
border = flavor.overlay0.hex;
};
urgent = {
childBorder = flavor.peach.hex;
background = flavor.base.hex;
text = flavor.peach.hex;
indicator = flavor.overlay0.hex;
border = flavor.peach.hex;
};
placeholder = {
childBorder = flavor.overlay0.hex;
background = flavor.base.hex;
text = flavor.text.hex;
indicator = flavor.overlay0.hex;
border = flavor.overlay0.hex;
};
background = flavor.base.hex;
};
gaps = {
outer = 6;
inner = 6;
smartBorders = "on";
smartGaps = true;
};
window = {
border = 1;
titlebar = false;
hideEdgeBorders = "smart";
};
};
};
programs.waybar = lib.mkIf config.programs.waybar.enable {
settings = {
main = {
position = "bottom";
};
};
style = ''
* {
font-family: "FontAwesome", Roboto, Helvetica, Arial, sans-serif;
font-size: 14px;
}
window#waybar {
border-top: 1px solid ${flavor.overlay0.hex};
background-color: ${flavor.mantle.hex};
color: ${flavor.text.hex};
}
.modules-left,
.modules-right {
margin: 4px;
}
#workspaces button {
font-size: 12px;
padding: 0px 2px;
background-color: transparent;
border-radius: 2px;;
color: ${flavor.overlay1.hex};
}
#workspaces button:hover {
text-decoration: underline;
}
#workspaces button.focused {
font-weight: bold;
background-color: rgba(${flavor.surface2.raw}, 0.4);
color: ${flavor.text.hex};
}
#workspaces button.urgent {
color: ${flavor.yellow.hex};
}
#clock,
#network,
#pulseaudio,
#tray {
padding: 0px 6px;
color: inherit;
}
#pulseaudio:hover {
background-color: rgba(${flavor.surface2.raw}, 0.4);
}
'';
};
# Colourise eza, 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}" = {
src = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1";
sha256 = "1g2r6j33f4zys853i1c5gnwcdbwb6xv5w6pazfdslxf69904lrg9";
};
file = "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.helix =
{
settings = {
theme = "catppuccin";
};
themes = {
catppuccin = {
"ui.linenr" = { fg = flavor.text.hex; bg = "none"; };
"ui.linenr.selected" = { fg = flavor.mauve.hex; bg = "none"; modifiers = [ "bold" ]; };
"ui.selection" = { bg = flavor.overlay1.hex; };
"ui.selection.primary" = { bg = flavor.overlay0.hex; };
"ui.virtual.indent-guide" = { fg = flavor.surface1.hex; };
"comment" = { fg = flavor.subtext0.hex; modifiers = [ "italic" ]; };
"ui.statusline" = { fg = flavor.text.hex; bg = flavor.surface0.hex; };
"ui.statusline.inactive" = { fg = flavor.subtext0.hex; bg = flavor.surface0.hex; };
"ui.help" = { fg = flavor.text.hex; bg = flavor.surface1.hex; };
"ui.cursor" = { modifiers = [ "reversed" ]; };
"ui.popup" = { fg = flavor.text.hex; bg = flavor.surface1.hex; };
"ui.menu" = { fg = flavor.text.hex; bg = flavor.surface0.hex; };
"ui.menu.selected" = { underline = { style = "line"; }; modifiers = [ "bold" ]; };
"ui.menu.scroll" = { fg = flavor.teal.hex; bg = flavor.overlay0.hex; };
"variable" = flavor.rosewater.hex;
"variable.builtin" = flavor.maroon.hex;
"variable.other.member" = flavor.rosewater.hex;
"constant" = flavor.maroon.hex;
"constant.character.escape" = flavor.sapphire.hex;
"constant.numeric" = flavor.mauve.hex;
"attributes" = flavor.flamingo.hex;
"type" = flavor.sapphire.hex;
"ui.cursor.match" = { fg = flavor.yellow.hex; modifiers = [ "underlined" ]; };
"string" = flavor.green.hex;
"function" = flavor.lavender.hex;
"constructor" = flavor.blue.hex;
"special" = flavor.blue.hex;
"keyword" = flavor.pink.hex;
"label" = flavor.pink.hex;
"namespace" = flavor.blue.hex;
"diff.plus" = flavor.green.hex;
"diff.delta" = flavor.yellow.hex;
"diff.minus" = flavor.red.hex;
"diagnostic" = { modifiers = [ "underlined" ]; };
"ui.gutter" = { bg = "none"; };
"info" = flavor.blue.hex;
"hint" = flavor.sky.hex;
"debug" = flavor.flamingo.hex;
"warning" = flavor.yellow.hex;
"error" = flavor.red.hex;
};
};
};
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
{
themeFile = "Catppuccin-${toCapital cfg.flavor}";
settings.background_opacity = 1.0;
};
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"
);
};
};
}