btw i use nix
1{
2 pkgs,
3 config,
4 lib,
5 ...
6}:
7
8let
9 cfg = config.custom.zsa;
10in
11{
12 options.custom.zsa = lib.mkOption {
13 type = lib.types.bool;
14 default = false;
15 };
16
17 config = lib.mkIf cfg {
18 environment.systemPackages = with pkgs; [ wally-cli ];
19 # ZSA Moonlander udev rules
20 services.udev.packages = [
21 (pkgs.writeTextFile {
22 name = "zsa-udev-rules";
23 text = ''
24 # Rules for Oryx web flashing and live training
25 KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev"
26 KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev"
27
28 # Legacy rules for live training over webusb (Not needed for firmware v21+)
29 # Rule for all ZSA keyboards
30 SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev"
31 # Rule for the Moonlander
32 SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev"
33 # Rule for the Ergodox EZ
34 SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev"
35 # Rule for the Planck EZ
36 SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev"
37
38 # Wally Flashing rules for the Ergodox EZ
39 ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
40 ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
41 SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
42 KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"
43
44 # Wally Flashing rules for the Moonlander and Planck EZ
45 SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu"
46 '';
47 destination = "/lib/udev/rules.d/50-zsa.rules";
48 })
49 ];
50 };
51}