Move QMK udev rules to package

This commit is contained in:
Erwin Boskma 2023-01-06 01:10:01 +01:00
parent c7fd035fdb
commit 29b60993ef
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
3 changed files with 47 additions and 7 deletions

View file

@ -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;

View file

@ -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"

View file

@ -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";
}];
};
}