me like nix
1{ inputs, ... }:
2
3{
4 flake.modules.nixos.desktop =
5 { pkgs, lib, ... }:
6 {
7 programs.niri.enable = true;
8
9 programs.regreet = {
10 enable = true;
11 cageArgs = [
12 "-s"
13 "-d"
14 ];
15 settings.GTK.application_prefer_dark_theme = true;
16 theme = {
17 package = pkgs.catppuccin-gtk.override {
18 variant = "frappe";
19 accents = [ "lavender" ];
20 size = "standard";
21 };
22 name = "catppuccin-frappe-lavender-standard";
23 };
24 iconTheme = {
25 package = pkgs.catppuccin-papirus-folders.override {
26 flavor = "frappe";
27 accent = "lavender";
28 };
29 name = "Papirus-Dark";
30 };
31 cursorTheme = {
32 package = pkgs.catppuccin-cursors.frappeDark;
33 name = "catppuccin-frappe-dark-cursors";
34 };
35 };
36
37 # Scale regreet's greeter for HiDPI displays
38 services.greetd.settings.default_session.command = lib.mkForce
39 "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} -s -d -- env GDK_SCALE=2 ${lib.getExe pkgs.regreet}";
40
41 # ZSA Keyboard udev rules for Oryx web flashing and live training
42 services.udev.extraRules = ''
43 # Rules for Oryx web flashing and live training
44 KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev"
45 KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev"
46
47 # Legacy rules for live training over webusb (Not needed for firmware v21+)
48 # Rule for all ZSA keyboards
49 SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev"
50 # Rule for the Moonlander
51 SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev"
52 # Rule for the Ergodox EZ
53 SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev"
54 # Rule for the Planck EZ
55 SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev"
56
57 # Wally Flashing rules for the Ergodox EZ
58 ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
59 ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
60 SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
61 KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"
62
63 # Keymapp / Wally Flashing rules for the Moonlander and Planck EZ
64 SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu"
65 # Keymapp Flashing rules for the Voyager
66 SUBSYSTEMS=="usb", ATTRS{idVendor}=="3297", MODE:="0666", SYMLINK+="ignition_dfu"
67 # USB serial device access via Chrome/Chromium
68 KERNEL=="ttyUSB[0-9]*", MODE:="0666", GROUP="dialout"
69 KERNEL=="ttyACM[0-9]*", MODE:="0666", GROUP="dialout"
70 '';
71 };
72
73 flake.modules.homeManager.desktop =
74 { pkgs, config, ... }:
75 let
76 wallpapers = import ./_data/wallpapers.nix;
77 downloads = builtins.concatStringsSep "\n" (
78 map (wp: ''
79 if [ ! -f "$DIR/${wp.filename}" ]; then
80 echo "Downloading ${wp.filename}..."
81 ${pkgs.curl}/bin/curl -fsSL -o "$DIR/${wp.filename}" ${
82 builtins.replaceStrings [ "\"" ] [ "\\\"" ] wp.url
83 } || echo "WARNING: Failed to download ${wp.filename}, skipping"
84 fi
85 '') wallpapers
86 );
87 in
88 {
89 home.packages = with pkgs; [
90 inputs.fsel.packages.${pkgs.stdenv.hostPlatform.system}.default
91 inputs.mako-tui.packages.${pkgs.stdenv.hostPlatform.system}.default
92 bemoji
93 networkmanager_dmenu
94 (import ../packages/cclip.nix { inherit pkgs; })
95 pavucontrol
96 playerctl
97 xwayland-satellite
98 ];
99
100 programs.niri = {
101 enable = true;
102 settings = {
103 window-rules = [
104 {
105 geometry-corner-radius = {
106 top-left = 5.0;
107 top-right = 5.0;
108 bottom-left = 5.0;
109 bottom-right = 5.0;
110 };
111 clip-to-geometry = true;
112 draw-border-with-background = false;
113 }
114 {
115 matches = [ { app-id = "^steam_app_"; } ];
116 border.enable = false;
117 open-fullscreen = true;
118 }
119 {
120 matches = [ { app-id = "^fsel$"; } ];
121 open-floating = true;
122 default-column-width.fixed = 800;
123 default-window-height.fixed = 500;
124 }
125 {
126 matches = [ { app-id = "^mako-tui$"; } ];
127 open-floating = true;
128 default-column-width.fixed = 800;
129 default-window-height.fixed = 500;
130 }
131 ];
132 debug = {
133 honor-xdg-activation-with-invalid-serial = { };
134 };
135 layout = {
136 focus-ring = {
137 width = 2;
138 active.color = "#8caaee";
139 inactive.color = "#414559";
140 };
141 struts = {
142 top = -6;
143 bottom = -6;
144 left = 0;
145 right = 0;
146 };
147 gaps = 8;
148 };
149 gestures = {
150 hot-corners = {
151 enable = false;
152 };
153 };
154 binds = {
155 "Mod+d".action.spawn = [
156 "alacritty"
157 "--class"
158 "fsel"
159 "-e"
160 "fsel"
161 "--detach"
162 ];
163 "Mod+c".action.spawn = [
164 "alacritty"
165 "--class"
166 "fsel"
167 "-e"
168 "fsel"
169 "--cclip"
170 ];
171 "Mod+e".action.spawn = "bemoji";
172 "Mod+n".action.spawn = [
173 "alacritty"
174 "--class"
175 "mako-tui"
176 "-e"
177 "mako-tui"
178 ];
179 "Mod+a".action.spawn = "alacritty";
180 "Mod+h".action = {
181 focus-column-left = { };
182 };
183 "Mod+j".action = {
184 focus-workspace-down = { };
185 };
186 "Mod+k".action = {
187 focus-workspace-up = { };
188 };
189 "Mod+l".action = {
190 focus-column-right = { };
191 };
192 "Mod+Shift+h".action = {
193 move-column-left = { };
194 };
195 "Mod+Shift+j".action = {
196 move-window-down-or-to-workspace-down = { };
197 };
198 "Mod+Shift+k".action = {
199 move-window-up-or-to-workspace-up = { };
200 };
201 "Mod+Shift+l".action = {
202 move-column-right = { };
203 };
204 "Mod+Down".action = {
205 move-workspace-down = { };
206 };
207 "Mod+Up".action = {
208 move-workspace-up = { };
209 };
210 "Mod+p".action = {
211 show-hotkey-overlay = { };
212 };
213 "Mod+o".action = {
214 toggle-overview = { };
215 };
216 "Mod+q".action = {
217 close-window = { };
218 };
219 "Mod+f".action = {
220 toggle-window-floating = { };
221 };
222 "Mod+Shift+f".action = {
223 switch-focus-between-floating-and-tiling = { };
224 };
225 "Mod+m".action = {
226 fullscreen-window = { };
227 };
228 "Mod+s".action = {
229 screenshot = {
230 show-pointer = true;
231 };
232 };
233 "Mod+1".action = {
234 set-column-width = "100%";
235 };
236 "Mod+2".action = {
237 set-column-width = "50%";
238 };
239 "Mod+Minus".action = {
240 set-column-width = "-10%";
241 };
242 "Mod+Equal".action = {
243 set-column-width = "+10%";
244 };
245 "Mod+Shift+q".action = {
246 quit = { };
247 };
248 "Mod+Shift+r".action.spawn = [
249 "systemctl"
250 "--user"
251 "restart"
252 "noctalia.service"
253 ];
254 "XF86AudioPlay".action.spawn = [
255 "playerctl"
256 "play-pause"
257 ];
258 "XF86AudioStop".action.spawn = [
259 "playerctl"
260 "stop"
261 ];
262 "XF86AudioNext".action.spawn = [
263 "playerctl"
264 "next"
265 ];
266 "XF86AudioPrev".action.spawn = [
267 "playerctl"
268 "previous"
269 ];
270 "XF86MonBrightnessDown".action.spawn = [
271 "brightnessctl"
272 "set"
273 "5%-"
274 ];
275 "XF86MonBrightnessUp".action.spawn = [
276 "brightnessctl"
277 "set"
278 "+5%"
279 ];
280 };
281 outputs = {
282 "DP-5" = {
283 scale = 2.0;
284 mode = {
285 width = 5120;
286 height = 2160;
287 refresh = 120.0;
288 };
289 position = {
290 x = 0;
291 y = 0;
292 };
293 };
294 "DP-1" = {
295 scale = 2.0;
296 mode = {
297 width = 5120;
298 height = 2160;
299 refresh = 120.0;
300 };
301 position = {
302 x = 0;
303 y = 0;
304 };
305 };
306 "DP-2" = {
307 scale = 1.0;
308 mode = {
309 width = 5120;
310 height = 2160;
311 refresh = 120.0;
312 };
313 position = {
314 x = 0;
315 y = 0;
316 };
317 };
318 "DP-6" = {
319 scale = 2.0;
320 mode = {
321 width = 5120;
322 height = 2160;
323 refresh = 120.0;
324 };
325 position = {
326 x = 0;
327 y = 0;
328 };
329 };
330 "DP-7" = {
331 scale = 2.0;
332 mode = {
333 width = 5120;
334 height = 2160;
335 refresh = 120.0;
336 };
337 position = {
338 x = 0;
339 y = 0;
340 };
341 };
342 "eDP-1" = {
343 scale = 1.5;
344 mode = {
345 width = 2560;
346 height = 1600;
347 refresh = 165.0;
348 };
349 position = {
350 x = 0;
351 y = 1080;
352 };
353 };
354 };
355 spawn-at-startup = [
356 { command = [ "xwayland-satellite" ]; }
357 { command = [ "cclipd" ]; }
358 ];
359 environment = {
360 DISPLAY = ":0";
361 };
362 };
363 };
364
365 programs.noctalia = {
366 enable = true;
367 systemd.enable = true;
368 settings = {
369 shell = {
370 launch_apps_as_systemd_services = true;
371 };
372 theme = {
373 mode = "dark";
374 source = "builtin";
375 builtin = "Catppuccin";
376 templates = {
377 enable_builtin_templates = false;
378 user = {
379 alacritty = {
380 input_path = "${inputs.noctalia}/assets/templates/alacritty/alacritty.toml";
381 output_path = "$XDG_CONFIG_HOME/alacritty/themes/noctalia.toml";
382 };
383 helix = {
384 input_path = "${inputs.noctalia}/assets/templates/helix/helix.toml";
385 output_path = "$XDG_CONFIG_HOME/helix/themes/noctalia.toml";
386 };
387 starship = {
388 input_path = "${inputs.noctalia}/assets/templates/starship/starship.toml";
389 output_path = "$XDG_CONFIG_HOME/starship/noctalia.toml";
390 post_hook = ''
391 ${pkgs.runtimeShell} -c '
392 file="''${XDG_CONFIG_HOME:-$HOME/.config}/starship/noctalia.toml"
393 ${pkgs.gnugrep}/bin/grep -qE "^palette[[:space:]]*=" "$file" \
394 || ${pkgs.gnused}/bin/sed -i "1ipalette = \\"noctalia\\"" "$file"
395 '
396 '';
397 };
398 zellij = {
399 input_path = "${inputs.noctalia-template-zellij}/zellij.kdl";
400 output_path = "$XDG_CONFIG_HOME/zellij/themes/noctalia.kdl";
401 };
402 };
403 };
404 };
405 wallpaper = {
406 enabled = true;
407 directory = "${config.home.homeDirectory}/Pictures/Wallpapers";
408 automation = {
409 enabled = true;
410 interval_minutes = 15;
411 order = "random";
412 recursive = true;
413 };
414 };
415 };
416 };
417
418 # Wallpaper downloads
419 home.activation.downloadWallpapers =
420 config.lib.dag.entryAfter [ "writeBoundary" ] ''
421 DIR="${config.home.homeDirectory}/Pictures/Wallpapers"
422 mkdir -p "$DIR"
423 ${downloads}
424 '';
425
426 services.udiskie = {
427 enable = true;
428 tray = "never";
429 automount = true;
430 };
431
432 services.mako = {
433 enable = true;
434 settings = {
435 border-radius = 8;
436 border-size = 2;
437 padding = "12";
438 margin = "12";
439 font = "BerkeleyMono Nerd Font 11";
440 on-button-left = "invoke-default-action";
441 on-button-right = "dismiss";
442 };
443 };
444
445 dconf.settings = {
446 "org/gnome/desktop/interface" = {
447 color-scheme = "prefer-dark";
448 enable-hot-corners = false;
449 };
450 };
451
452 home.pointerCursor = {
453 name = "Adwaita";
454 package = pkgs.adwaita-icon-theme;
455 size = 16;
456 x11.enable = true;
457 gtk.enable = true;
458 };
459 };
460}