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