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 "XF86AudioMute".action.spawn = [
271 "noctalia"
272 "msg"
273 "volume-mute"
274 ];
275 "XF86AudioLowerVolume".action.spawn = [
276 "noctalia"
277 "msg"
278 "volume-down"
279 "5%"
280 ];
281 "XF86AudioRaiseVolume".action.spawn = [
282 "noctalia"
283 "msg"
284 "volume-up"
285 "5%"
286 ];
287 "XF86MonBrightnessDown".action.spawn = [
288 "brightnessctl"
289 "set"
290 "5%-"
291 ];
292 "XF86MonBrightnessUp".action.spawn = [
293 "brightnessctl"
294 "set"
295 "+5%"
296 ];
297 };
298 outputs = {
299 "DP-5" = {
300 scale = 2.0;
301 mode = {
302 width = 5120;
303 height = 2160;
304 refresh = 120.0;
305 };
306 position = {
307 x = 0;
308 y = 0;
309 };
310 };
311 "DP-1" = {
312 scale = 2.0;
313 mode = {
314 width = 5120;
315 height = 2160;
316 refresh = 120.0;
317 };
318 position = {
319 x = 0;
320 y = 0;
321 };
322 };
323 "DP-2" = {
324 scale = 1.0;
325 mode = {
326 width = 5120;
327 height = 2160;
328 refresh = 120.0;
329 };
330 position = {
331 x = 0;
332 y = 0;
333 };
334 };
335 "DP-6" = {
336 scale = 2.0;
337 mode = {
338 width = 5120;
339 height = 2160;
340 refresh = 120.0;
341 };
342 position = {
343 x = 0;
344 y = 0;
345 };
346 };
347 "DP-7" = {
348 scale = 2.0;
349 mode = {
350 width = 5120;
351 height = 2160;
352 refresh = 120.0;
353 };
354 position = {
355 x = 0;
356 y = 0;
357 };
358 };
359 "eDP-1" = {
360 scale = 1.5;
361 mode = {
362 width = 2560;
363 height = 1600;
364 refresh = 165.0;
365 };
366 position = {
367 x = 0;
368 y = 1080;
369 };
370 };
371 };
372 spawn-at-startup = [
373 { command = [ "xwayland-satellite" ]; }
374 { command = [ "cclipd" ]; }
375 ];
376 environment = {
377 DISPLAY = ":0";
378 };
379 };
380 };
381
382 programs.noctalia = {
383 enable = true;
384 systemd.enable = true;
385 settings = {
386 shell = {
387 launch_apps_as_systemd_services = true;
388 };
389 theme = {
390 mode = "dark";
391 source = "builtin";
392 builtin = "Catppuccin";
393 templates = {
394 enable_builtin_templates = false;
395 user = {
396 alacritty = {
397 input_path = "${inputs.noctalia}/assets/templates/alacritty/alacritty.toml";
398 output_path = "$XDG_CONFIG_HOME/alacritty/themes/noctalia.toml";
399 };
400 helix = {
401 input_path = "${inputs.noctalia}/assets/templates/helix/helix.toml";
402 output_path = "$XDG_CONFIG_HOME/helix/themes/noctalia.toml";
403 };
404 starship = {
405 input_path = "${inputs.noctalia}/assets/templates/starship/starship.toml";
406 output_path = "$XDG_CONFIG_HOME/starship/noctalia.toml";
407 post_hook = ''
408 ${pkgs.runtimeShell} -c '
409 file="''${XDG_CONFIG_HOME:-$HOME/.config}/starship/noctalia.toml"
410 ${pkgs.gnugrep}/bin/grep -qE "^palette[[:space:]]*=" "$file" \
411 || ${pkgs.gnused}/bin/sed -i "1ipalette = \\"noctalia\\"" "$file"
412 '
413 '';
414 };
415 zellij = {
416 input_path = "${inputs.noctalia-template-zellij}/zellij.kdl";
417 output_path = "$XDG_CONFIG_HOME/zellij/themes/noctalia.kdl";
418 };
419 };
420 };
421 };
422 wallpaper = {
423 enabled = true;
424 directory = "${config.home.homeDirectory}/Pictures/Wallpapers";
425 automation = {
426 enabled = true;
427 interval_minutes = 15;
428 order = "random";
429 recursive = true;
430 };
431 };
432 };
433 };
434
435 # Wallpaper downloads
436 home.activation.downloadWallpapers =
437 config.lib.dag.entryAfter [ "writeBoundary" ] ''
438 DIR="${config.home.homeDirectory}/Pictures/Wallpapers"
439 mkdir -p "$DIR"
440 ${downloads}
441 '';
442
443 services.udiskie = {
444 enable = true;
445 tray = "never";
446 automount = true;
447 };
448
449 services.mako = {
450 enable = true;
451 settings = {
452 border-radius = 8;
453 border-size = 2;
454 padding = "12";
455 margin = "12";
456 font = "BerkeleyMono Nerd Font 11";
457 on-button-left = "invoke-default-action";
458 on-button-right = "dismiss";
459 };
460 };
461
462 dconf.settings = {
463 "org/gnome/desktop/interface" = {
464 color-scheme = "prefer-dark";
465 enable-hot-corners = false;
466 };
467 };
468
469 home.pointerCursor = {
470 name = "Adwaita";
471 package = pkgs.adwaita-icon-theme;
472 size = 16;
473 x11.enable = true;
474 gtk.enable = true;
475 };
476 };
477}