Unverified Commit d05426b8 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

keychron-udev-rules: init at 23-10-2025 (#454769)

parents 8c91337b 5cd26d10
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -13989,6 +13989,12 @@
    name = "Tomas Krupka";
    matrix = "@krupkat:matrix.org";
  };
  kruziikrel13 = {
    github = "kruziikrel13";
    name = "Michael Petersen";
    email = "dev@michaelpetersen.io";
    githubId = 72793125;
  };
  krzaczek = {
    name = "Pawel Krzaczkowski";
    email = "pawel@printu.pl";
+5 −2
Original line number Diff line number Diff line
@@ -8,15 +8,18 @@
let
  cfg = config.hardware.keyboard.qmk;
  inherit (lib) mkEnableOption mkIf;

in
{
  options.hardware.keyboard.qmk = {
    enable = mkEnableOption "non-root access to the firmware of QMK keyboards";
    keychronSupport = mkEnableOption "udev rules for keychron QMK based keyboards";
  };

  config = mkIf cfg.enable {
    services.udev.packages = [ pkgs.qmk-udev-rules ];
    services.udev.packages = [
      pkgs.qmk-udev-rules
    ]
    ++ lib.optionals cfg.keychronSupport [ pkgs.keychron-udev-rules ];
    users.groups.plugdev = { };
  };
}
+37 −0
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  udevCheckHook,
  writeTextFile,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "keychron-udev-rules";
  version = "23-10-2025";

  nativeBuildInputs = [ udevCheckHook ];

  src = writeTextFile {
    name = "69-keychron.rules";
    text = ''
      KERNEL=="event*", SUBSYSTEM=="input", ENV{ID_VENDOR_ID}=="3434", ENV{ID_INPUT_JOYSTICK}=="*?", ENV{ID_INPUT_JOYSTICK}=""
    '';
  };

  dontConfigure = true;
  dontUnpack = true;
  dontBuild = true;
  dontFixup = true;

  installPhase = ''
    runHook preInstall
    install -Dm644 $src $out/lib/udev/rules.d/69-keychron.rules
    runHook postInstall
  '';

  meta = with lib; {
    description = "Keychron Keyboard Udev Rules, fixes issues with keyboard detection on Linux";
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = with maintainers; [ kruziikrel13 ];
  };
})