-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
184 lines (152 loc) · 5.13 KB
/
default.nix
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
_: { config, lib, pkgs, xdg, ... }: let
# Data for all themes
themes = {
catppuccin-mocha = {
name = "Catppuccin-Mocha";
gtk = { theme = "Catppuccin-Mocha"; package = pkgs.catppuccin-gtk; };
icon = { theme = "Tela-circle-dracula"; package = pkgs.tela-circle-icon-theme; };
vs-code-theme = "Catppuccin Mocha";
};
cyberpunk-edge = {
name = "Cyberpunk-Edge";
# TODO: Fix this when cyberpunk-edge available
gtk = { theme = "Tokyonight-Dark-B"; package = pkgs.tokyo-night-gtk; };
icon = { theme = "Tela-circle-yellow"; package = pkgs.tela-circle-icon-theme; };
vs-code-theme = "cyberpunk2077";
};
rose-pine = {
name = "Rose-Pine";
gtk = { theme = "rose-pine"; package = pkgs.rose-pine-gtk-theme; };
icon = { theme = "Tela-circle-pink"; package = pkgs.tela-circle-icon-theme; };
vs-code-theme = "Rosé Pine";
};
tokyo-night = {
name = "Tokyo-Night";
gtk = { theme = "Tokyonight-Dark-B"; package = pkgs.tokyo-night-gtk; };
icon = { theme = "Tela-circle-purple"; package = pkgs.tela-circle-icon-theme; };
vs-code-theme = "Tokyo Night";
};
};
# Themes as a list
theme-list = builtins.attrValues themes;
# All theme packages
theme-packages = (lib.lists.concatMap (theme: [
theme.gtk.package
theme.icon.package
]) theme-list);
# Convenience function for installing themes
add-themes = (dir: (extension:
lib.mkMerge (lib.lists.forEach theme-list (theme: {
xdg.configFile."themes/config/${dir}/${theme.name}${extension}" = {
source = ./config/${dir}/${theme.name}${extension};
};
})
)));
in {
# Add options for theme configuration
options.themes.enable = lib.mkEnableOption "themes";
# Enable theme switching if desired
config = lib.mkIf config.themes.enable (lib.mkMerge [
# General configuration
{
# Copy scripts and other data
xdg.configFile."themes/scripts".source = ./scripts;
# Create theme data file
xdg.configFile."themes/theme-data.conf" = {
text = (lib.strings.concatLines (
[ "<theme-name>|<gtk>|icons>|<vs-code>" ] ++
(lib.lists.forEach theme-list (theme:
theme.name
+ "|" + theme.gtk.theme
+ "|" + theme.icon.theme
+ "|" + theme.vs-code-theme
))
));
};
# Install theming-specific packages
home.packages = with pkgs; theme-packages ++ [
# Wallpaper daemon for wayland
swww
# Allows access to 'kvantummanager' for configuring QT
libsForQt5.qtstyleplugin-kvantum
# Allows for json parsing
jq
# Allows for substitution of variables
envsubst
# Allows for editing of images
imagemagick
];
}
# Install theme wallpapers
(lib.mkMerge (lib.lists.forEach theme-list (theme: {
xdg.configFile."themes/wallpapers/${theme.name}"= {
source = ./wallpapers/${theme.name};
};
})))
# Install gtk themes
(lib.mkIf config.gtk.enable {
xdg.configFile."gtk-3.0/settings.ini" = {
target = "gtk-3.0/base_settings.ini";
};
})
# Install qt themes
(lib.mkIf config.qt.enable (lib.mkMerge [(add-themes "qt5ct" ".conf") {
xdg.configFile."qt5ct/qt5ct.conf" = {
target = "qt5ct/base_qt5ct.conf";
};
}]))
# Install kvantum themes
(lib.mkMerge (lib.lists.forEach theme-list (theme: {
xdg.configFile."Kvantum/${theme.name}" = {
source = ./config/kvantum/${theme.name};
};
})))
# Enable css themes
(add-themes "css" ".css")
# Enable themes for waybar
(lib.mkIf config.waybar.enable {
xdg.configFile."waybar/extra-style.css".text = ''
@import "theme.css";
'';
})
# Enable themes for rofi application switcher
(lib.mkIf config.rofi.enable (lib.mkMerge [(add-themes "rofi" ".rasi") {
xdg.configFile."rofi/extra-config.rasi".text = ''
@theme "~/.config/themes/rofi.rasi"
'';
}]))
# Enable themes for dunst
(lib.mkIf config.waybar.enable (lib.mkMerge [(add-themes "dunst" "") {
xdg.configFile."dunst/dunstrc" = {
target = "dunst/base_dunstrc";
};
}]))
# Enable themes for wlogout
(lib.mkIf config.wlogout.enable {
xdg.configFile."wlogout/extra-style.css".text = ''
@import "theme.css";
'';
})
# Enable themes for kitty terminal
(lib.mkIf config.kitty.enable (lib.mkMerge [(add-themes "kitty" ".conf") {
programs.kitty.settings = {
"include" = "~/.config/themes/kitty.conf";
};
}]))
# Enable themes for vs-code
(lib.mkIf config.vs-code.enable {
xdg.configFile."Code/User/settings.json" = {
target = "Code/User/base_settings.json";
};
})
# Enable themes for hyprland
(lib.mkIf config.hyprland.enable (lib.mkMerge [(add-themes "hyprland" ".conf") {
wayland.windowManager.hyprland.extraConfig = ''
# Reset theme
exec = ~/.config/themes/scripts/switch-theme.sh -i
# Change hyprland colourscheme
source=~/.config/themes/hyprland.conf
'';
}]))
]);
}