diff options
Diffstat (limited to '')
-rw-r--r-- | modules/system/hardware/default.nix | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/modules/system/hardware/default.nix b/modules/system/hardware/default.nix new file mode 100644 index 00000000..acf9fb2e --- /dev/null +++ b/modules/system/hardware/default.nix @@ -0,0 +1,68 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.hardware; +in { + options.soispha.hardware = { + enable = lib.mkEnableOption "udev rules for devices I use"; + moonlander = { + enableLiveTraining = lib.mkEnableOption "udev rules for live training"; + enableFlashing = lib.mkEnableOption "udev rules for firmware flashing"; + }; + }; + + config = lib.mkIf cfg.enable { + hardware = { + keyboard.zsa.enable = false; + nitrokey.enable = true; + + # TODO: Remove this once I know, that it is no longer necessary <2024-05-16> + onlykey.enable = true; + + opengl = { + enable = true; + extraPackages = builtins.attrValues { + inherit + (pkgs) + vaapiVdpau + libvdpau-va-gl + ; + }; + }; + }; + + # TODO: Remove the support for the old keyboards <2024-05-16> + services.udev.extraRules = + lib.mkIf cfg.moonlander.enableLiveTraining '' + # Rules for Oryx web flashing and live training + KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev" + KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev" + + # Legacy rules for live training over webusb (Not needed for firmware v21+) + # Rule for all ZSA keyboards + SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev" + # Rule for the Moonlander + SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev" + # Rule for the Ergodox EZ + SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev" + # Rule for the Planck EZ + SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev" + '' + + lib.mkIf cfg.moonlander.enableFlashing + '' + # Wally Flashing rules for the Ergodox EZ + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" + KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" + + # Wally Flashing rules for the Moonlander and Planck EZ + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", \ + MODE:="0666", \ + SYMLINK+="stm32_dfu" + ''; + }; +} |