diff --git a/modules/base/default.nix b/modules/base/default.nix index 6d95694..28c221b 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -5,7 +5,10 @@ }: with lib; let cfg = config.eboskma.base; - qmkUdevRules = builtins.readFile ./qmk.rules; + qmkUdevRules = pkgs.callPackage ./qmk { + inherit (pkgs.stdenv) mkDerivation; + inherit lib; + }; probersRules = pkgs.callPackage ./probe-rs { inherit (pkgs.stdenv) mkDerivation; inherit lib; @@ -42,7 +45,7 @@ in }; udev-rules = { - qmk = mkEnableOption "qmk udev rules"; # No-op for now + qmk = mkEnableOption "qmk udev rules"; probe-rs = mkEnableOption "probe.rs udev rules"; blink1 = mkEnableOption "blink(1) udev rules"; picotool = mkEnableOption "picotool udev rules"; @@ -80,11 +83,11 @@ in ]; services.udev = { - extraRules = qmkUdevRules; - packages = [ ] ++ (optional cfg.udev-rules.probe-rs [ probersRules ]) - ++ (optional cfg.udev-rules.blink1 [ blink1Rules ]) - ++ (optional cfg.udev-rules.picotool [ picotoolRules ]) - ++ (optional cfg.udev-rules.solo2 [ solo2Rules ]); + packages = [ ] ++ (optional cfg.udev-rules.qmk qmkUdevRules) + ++ (optional cfg.udev-rules.probe-rs probersRules) + ++ (optional cfg.udev-rules.blink1 blink1Rules) + ++ (optional cfg.udev-rules.picotool picotoolRules) + ++ (optional cfg.udev-rules.solo2 solo2Rules); }; services.nscd.enableNsncd = true; diff --git a/modules/base/qmk.rules b/modules/base/qmk/50-qmk.rules similarity index 92% rename from modules/base/qmk.rules rename to modules/base/qmk/50-qmk.rules index 57806f9..86f1dc9 100644 --- a/modules/base/qmk.rules +++ b/modules/base/qmk/50-qmk.rules @@ -28,6 +28,9 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", TAG+="uacc # USBAspLoader SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", TAG+="uaccess" +# USBtinyISP +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1782", ATTRS{idProduct}=="0c9f", TAG+="uaccess" + # ModemManager should ignore the following devices # Atmel SAM-BA (Massdrop) SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" @@ -72,3 +75,9 @@ KERNEL=="hidraw*", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2067", TAG+="uaccess" ## PJRC's HalfKay SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0478", TAG+="uaccess" + +# APM32 DFU +SUBSYSTEMS=="usb", ATTRS{idVendor}=="314b", ATTRS{idProduct}=="0106", TAG+="uaccess" + +# GD32V DFU +SUBSYSTEMS=="usb", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", TAG+="uaccess" diff --git a/modules/base/qmk/default.nix b/modules/base/qmk/default.nix new file mode 100644 index 0000000..0e52f46 --- /dev/null +++ b/modules/base/qmk/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, ... }: +let + pname = "qmk-udev-rules"; + version = "0.19.6"; +in +stdenv.mkDerivation { + inherit pname version; + + src = ./.; + + phases = [ "installPhase" ]; + + installPhase = '' + install -D $src/50-qmk.rules $out/lib/udev/rules.d/50-qmk.rules + ''; + + meta = with lib; { + description = "udev rules for QMK based keyboards"; + homepage = "https://qmk.fm"; + license = licenses.gpl2; + platforms = platforms.linux; + maintainers = [{ + email = "erwin@datarift.nl"; + github = "eboskma"; + name = "Erwin Boskma"; + }]; + }; +}