From 1aef3db69db815f6e0769acc5905259109d23cfd Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Fri, 7 Nov 2025 02:26:13 +0100 Subject: [PATCH] feat(hardware): move hardware inputs to dedicated module --- hosts/gampo/configuration.nix | 8 +++++--- hosts/marpa/configuration.nix | 11 +++++++++-- system/hardware/default.nix | 4 +--- system/hardware/{ => input}/corne.nix | 4 ++-- system/hardware/input/default.nix | 8 ++++++++ system/hardware/{ => input}/ibm-trackpoint.nix | 4 ++-- system/hardware/{ => input}/opentablet.nix | 4 ++-- system/hardware/input/trackball.nix | 3 +++ 8 files changed, 32 insertions(+), 14 deletions(-) rename system/hardware/{ => input}/corne.nix (62%) create mode 100644 system/hardware/input/default.nix rename system/hardware/{ => input}/ibm-trackpoint.nix (59%) rename system/hardware/{ => input}/opentablet.nix (51%) create mode 100644 system/hardware/input/trackball.nix diff --git a/hosts/gampo/configuration.nix b/hosts/gampo/configuration.nix index e8bb093..617e6e0 100644 --- a/hosts/gampo/configuration.nix +++ b/hosts/gampo/configuration.nix @@ -34,9 +34,11 @@ }; hardware = { bluetooth.enable = true; - corne.allowHidAccess = true; - ibmTrackpoint.disable = true; - opentablet.enable = true; + input = { + corne.allowHidAccess = true; + ibmTrackpoint.disable = true; + opentablet.enable = true; + }; sound.enable = true; }; misc.keymap = "fr-bepo"; diff --git a/hosts/marpa/configuration.nix b/hosts/marpa/configuration.nix index 1c30859..f9ddfea 100644 --- a/hosts/marpa/configuration.nix +++ b/hosts/marpa/configuration.nix @@ -38,8 +38,10 @@ hardware = { amdgpu.enable = true; bluetooth.enable = true; - corne.allowHidAccess = true; - opentablet.enable = true; + input = { + corne.allowHidAccess = true; + opentablet.enable = true; + }; sound = { enable = true; jack = true; @@ -90,6 +92,11 @@ mode = "0440"; }; + services.udev.extraHwdb = '' + mouse:usb:047d:80a6:* + LIBINPUT_MIDDLE_EMULATION_ENABLED=1 + ''; + security = { polkit.enable = true; rtkit.enable = true; diff --git a/system/hardware/default.nix b/system/hardware/default.nix index eb0bf6d..33a45d6 100644 --- a/system/hardware/default.nix +++ b/system/hardware/default.nix @@ -2,9 +2,7 @@ imports = [ ./amdgpu.nix ./bluetooth.nix - ./corne.nix - ./ibm-trackpoint.nix - ./opentablet.nix ./sound.nix + ./input ]; } diff --git a/system/hardware/corne.nix b/system/hardware/input/corne.nix similarity index 62% rename from system/hardware/corne.nix rename to system/hardware/input/corne.nix index 9929cf4..5c52d39 100644 --- a/system/hardware/corne.nix +++ b/system/hardware/input/corne.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.mySystem.hardware.corne; + cfg = config.mySystem.hardware.input.corne; in { - options.mySystem.hardware.corne.allowHidAccess = mkEnableOption "Enable HID access to the corne keyboard"; + options.mySystem.hardware.input.corne.allowHidAccess = mkEnableOption "Enable HID access to the corne keyboard"; config.services.udev = mkIf cfg.allowHidAccess { extraRules = '' KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl" diff --git a/system/hardware/input/default.nix b/system/hardware/input/default.nix new file mode 100644 index 0000000..270e870 --- /dev/null +++ b/system/hardware/input/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./corne.nix + ./ibm-trackpoint.nix + ./opentablet.nix + ./trackball.nix + ]; +} diff --git a/system/hardware/ibm-trackpoint.nix b/system/hardware/input/ibm-trackpoint.nix similarity index 59% rename from system/hardware/ibm-trackpoint.nix rename to system/hardware/input/ibm-trackpoint.nix index 8e4edd7..c6b5a76 100644 --- a/system/hardware/ibm-trackpoint.nix +++ b/system/hardware/input/ibm-trackpoint.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.mySystem.hardware.ibmTrackpoint; + cfg = config.mySystem.hardware.input.ibmTrackpoint; in { - options.mySystem.hardware.ibmTrackpoint.disable = mkEnableOption "Disable IBM’s trackpoint on ThinkPad"; + options.mySystem.hardware.input.ibmTrackpoint.disable = mkEnableOption "Disable IBM’s trackpoint on ThinkPad"; config.services.udev = mkIf cfg.disable { extraRules = '' ATTRS{name}=="*TPPS/2 IBM TrackPoint", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}="" diff --git a/system/hardware/opentablet.nix b/system/hardware/input/opentablet.nix similarity index 51% rename from system/hardware/opentablet.nix rename to system/hardware/input/opentablet.nix index b93b28b..2ead577 100644 --- a/system/hardware/opentablet.nix +++ b/system/hardware/input/opentablet.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.mySystem.hardware.opentablet; + cfg = config.mySystem.hardware.input.opentablet; in { - options.mySystem.hardware.opentablet.enable = mkEnableOption "Enables OpenTablet drivers"; + options.mySystem.hardware.input.opentablet.enable = mkEnableOption "Enables OpenTablet drivers"; config.hardware.opentabletdriver = mkIf cfg.enable { inherit (cfg) enable; daemon.enable = true; diff --git a/system/hardware/input/trackball.nix b/system/hardware/input/trackball.nix new file mode 100644 index 0000000..dc92129 --- /dev/null +++ b/system/hardware/input/trackball.nix @@ -0,0 +1,3 @@ +{ + services.libinput.mouse.middleEmulation = true; +}