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 bemoji
92 networkmanager_dmenu
93 (import ../packages/cclip.nix { inherit pkgs; })
94 pavucontrol
95 playerctl
96 xwayland-satellite
97 ];
98
99 programs.niri = {
100 enable = true;
101 settings = {
102 window-rules = [
103 {
104 geometry-corner-radius = {
105 top-left = 5.0;
106 top-right = 5.0;
107 bottom-left = 5.0;
108 bottom-right = 5.0;
109 };
110 clip-to-geometry = true;
111 draw-border-with-background = false;
112 }
113 {
114 matches = [ { app-id = "^steam_app_"; } ];
115 border.enable = false;
116 open-fullscreen = true;
117 }
118 {
119 matches = [ { app-id = "^fsel$"; } ];
120 open-floating = true;
121 default-column-width.fixed = 800;
122 default-window-height.fixed = 500;
123 }
124 ];
125 debug = {
126 honor-xdg-activation-with-invalid-serial = { };
127 };
128 layout = {
129 focus-ring = {
130 width = 2;
131 active.color = "#8caaee";
132 inactive.color = "#414559";
133 };
134 struts = {
135 top = -6;
136 bottom = -6;
137 left = 0;
138 right = 0;
139 };
140 gaps = 8;
141 };
142 gestures = {
143 hot-corners = {
144 enable = false;
145 };
146 };
147 binds = {
148 "Mod+d".action.spawn = [
149 "alacritty"
150 "--class"
151 "fsel"
152 "-e"
153 "fsel"
154 "--detach"
155 ];
156 "Mod+c".action.spawn = [
157 "alacritty"
158 "--class"
159 "fsel"
160 "-e"
161 "fsel"
162 "--cclip"
163 ];
164 "Mod+e".action.spawn = "bemoji";
165 "Mod+n".action.spawn = [
166 "noctalia"
167 "msg"
168 "panel-toggle"
169 "notifications"
170 ];
171 "Mod+a".action.spawn = "alacritty";
172 "Mod+h".action = {
173 focus-column-left = { };
174 };
175 "Mod+j".action = {
176 focus-workspace-down = { };
177 };
178 "Mod+k".action = {
179 focus-workspace-up = { };
180 };
181 "Mod+l".action = {
182 focus-column-right = { };
183 };
184 "Mod+Shift+h".action = {
185 move-column-left = { };
186 };
187 "Mod+Shift+j".action = {
188 move-window-down-or-to-workspace-down = { };
189 };
190 "Mod+Shift+k".action = {
191 move-window-up-or-to-workspace-up = { };
192 };
193 "Mod+Shift+l".action = {
194 move-column-right = { };
195 };
196 "Mod+Down".action = {
197 move-workspace-down = { };
198 };
199 "Mod+Up".action = {
200 move-workspace-up = { };
201 };
202 "Mod+p".action = {
203 show-hotkey-overlay = { };
204 };
205 "Mod+o".action = {
206 toggle-overview = { };
207 };
208 "Mod+q".action = {
209 close-window = { };
210 };
211 "Mod+f".action = {
212 toggle-window-floating = { };
213 };
214 "Mod+Shift+f".action = {
215 switch-focus-between-floating-and-tiling = { };
216 };
217 "Mod+m".action = {
218 fullscreen-window = { };
219 };
220 "Mod+s".action = {
221 screenshot = {
222 show-pointer = true;
223 };
224 };
225 "Mod+1".action = {
226 set-column-width = "100%";
227 };
228 "Mod+2".action = {
229 set-column-width = "50%";
230 };
231 "Mod+Minus".action = {
232 set-column-width = "-10%";
233 };
234 "Mod+Equal".action = {
235 set-column-width = "+10%";
236 };
237 "Mod+Shift+q".action = {
238 quit = { };
239 };
240 "Mod+Shift+r".action.spawn = [
241 "systemctl"
242 "--user"
243 "restart"
244 "noctalia.service"
245 ];
246 "XF86AudioPlay".action.spawn = [
247 "playerctl"
248 "play-pause"
249 ];
250 "XF86AudioStop".action.spawn = [
251 "playerctl"
252 "stop"
253 ];
254 "XF86AudioNext".action.spawn = [
255 "playerctl"
256 "next"
257 ];
258 "XF86AudioPrev".action.spawn = [
259 "playerctl"
260 "previous"
261 ];
262 "XF86AudioMute".action.spawn = [
263 "noctalia"
264 "msg"
265 "volume-mute"
266 ];
267 "XF86AudioLowerVolume".action.spawn = [
268 "noctalia"
269 "msg"
270 "volume-down"
271 "5%"
272 ];
273 "XF86AudioRaiseVolume".action.spawn = [
274 "noctalia"
275 "msg"
276 "volume-up"
277 "5%"
278 ];
279 "XF86MonBrightnessDown".action.spawn = [
280 "brightnessctl"
281 "set"
282 "5%-"
283 ];
284 "XF86MonBrightnessUp".action.spawn = [
285 "brightnessctl"
286 "set"
287 "+5%"
288 ];
289 };
290 outputs = {
291 "DP-5" = {
292 scale = 2.0;
293 mode = {
294 width = 5120;
295 height = 2160;
296 refresh = 120.0;
297 };
298 position = {
299 x = 0;
300 y = 0;
301 };
302 };
303 "DP-1" = {
304 scale = 2.0;
305 mode = {
306 width = 5120;
307 height = 2160;
308 refresh = 120.0;
309 };
310 position = {
311 x = 0;
312 y = 0;
313 };
314 };
315 "DP-2" = {
316 scale = 1.0;
317 mode = {
318 width = 5120;
319 height = 2160;
320 refresh = 120.0;
321 };
322 position = {
323 x = 0;
324 y = 0;
325 };
326 };
327 "DP-6" = {
328 scale = 2.0;
329 mode = {
330 width = 5120;
331 height = 2160;
332 refresh = 120.0;
333 };
334 position = {
335 x = 0;
336 y = 0;
337 };
338 };
339 "DP-7" = {
340 scale = 2.0;
341 mode = {
342 width = 5120;
343 height = 2160;
344 refresh = 120.0;
345 };
346 position = {
347 x = 0;
348 y = 0;
349 };
350 };
351 "eDP-1" = {
352 scale = 1.5;
353 mode = {
354 width = 2560;
355 height = 1600;
356 refresh = 165.0;
357 };
358 position = {
359 x = 0;
360 y = 1080;
361 };
362 };
363 };
364 spawn-at-startup = [
365 { command = [ "xwayland-satellite" ]; }
366 { command = [ "cclipd" ]; }
367 ];
368 environment = {
369 DISPLAY = ":0";
370 };
371 };
372 };
373
374 programs.noctalia = {
375 enable = true;
376 systemd.enable = true;
377 settings = {
378 shell = {
379 launch_apps_as_systemd_services = true;
380 };
381 theme = {
382 mode = "dark";
383 source = "builtin";
384 builtin = "Catppuccin";
385 templates = {
386 enable_builtin_templates = false;
387 user = {
388 alacritty = {
389 input_path = "${inputs.noctalia}/assets/templates/alacritty/alacritty.toml";
390 output_path = "$XDG_CONFIG_HOME/alacritty/themes/noctalia.toml";
391 };
392 helix = {
393 input_path = "${inputs.noctalia}/assets/templates/helix/helix.toml";
394 output_path = "$XDG_CONFIG_HOME/helix/themes/noctalia.toml";
395 };
396 starship = {
397 input_path = "${inputs.noctalia}/assets/templates/starship/starship.toml";
398 output_path = "$XDG_CONFIG_HOME/starship/noctalia.toml";
399 post_hook = ''
400 ${pkgs.runtimeShell} -c '
401 file="''${XDG_CONFIG_HOME:-$HOME/.config}/starship/noctalia.toml"
402 ${pkgs.gnugrep}/bin/grep -qE "^palette[[:space:]]*=" "$file" \
403 || ${pkgs.gnused}/bin/sed -i "1ipalette = \\"noctalia\\"" "$file"
404 '
405 '';
406 };
407 zellij = {
408 input_path = "${inputs.noctalia-template-zellij}/zellij.kdl";
409 output_path = "$XDG_CONFIG_HOME/zellij/themes/noctalia.kdl";
410 };
411 };
412 };
413 };
414 notification = {
415 enable_daemon = true;
416 show_app_name = true;
417 show_actions = true;
418 layer = "top";
419 scale = 1.0;
420 background_opacity = 0.97;
421 offset_x = 20;
422 offset_y = 8;
423 };
424 wallpaper = {
425 enabled = true;
426 directory = "${config.home.homeDirectory}/Pictures/Wallpapers";
427 automation = {
428 enabled = true;
429 interval_minutes = 15;
430 order = "random";
431 recursive = true;
432 };
433 };
434 };
435 };
436
437 # Wallpaper downloads
438 home.activation.downloadWallpapers =
439 config.lib.dag.entryAfter [ "writeBoundary" ] ''
440 DIR="${config.home.homeDirectory}/Pictures/Wallpapers"
441 mkdir -p "$DIR"
442 ${downloads}
443 '';
444
445 services.udiskie = {
446 enable = true;
447 tray = "never";
448 automount = true;
449 };
450
451 dconf.settings = {
452 "org/gnome/desktop/interface" = {
453 color-scheme = "prefer-dark";
454 enable-hot-corners = false;
455 };
456 };
457
458 home.pointerCursor = {
459 name = "Adwaita";
460 package = pkgs.adwaita-icon-theme;
461 size = 16;
462 x11.enable = true;
463 gtk.enable = true;
464 };
465 };
466}