diff --git a/machines/little-rascal/configuration.nix b/machines/little-rascal/configuration.nix index 28de999..0de6aea 100644 --- a/machines/little-rascal/configuration.nix +++ b/machines/little-rascal/configuration.nix @@ -21,6 +21,7 @@ ../../modules/desktop/niri.nix ../../modules/desktop/cosmic.nix ../../modules/desktop/fonts.nix + ../../modules/desktop/input.nix # Development ../../modules/development/tools.nix diff --git a/machines/little-rascal/hardware-configuration.nix b/machines/little-rascal/hardware-configuration.nix index 5345f2d..b9374f1 100644 --- a/machines/little-rascal/hardware-configuration.nix +++ b/machines/little-rascal/hardware-configuration.nix @@ -20,11 +20,22 @@ "usb_storage" "sd_mod" "sdhci_pci" + # I2C modules for touchpad support + "i2c_hid" + "i2c_hid_acpi" + "i2c_piix4" ]; kernelModules = []; }; - kernelModules = ["kvm-amd"]; # AMD Ryzen system + kernelModules = [ + "kvm-amd" # AMD Ryzen system + # HID and input modules for touchpad + "hid_generic" + "hid_multitouch" + "i2c_hid" + "i2c_hid_acpi" + ]; extraModulePackages = []; }; @@ -58,20 +69,18 @@ enableRedistributableFirmware = true; # Graphics configuration - AMD Radeon Vega (integrated) + # Using open source driver without ROCm and 32-bit support graphics = { enable = true; - enable32Bit = true; + enable32Bit = false; # Disabled 32-bit support - # AMD integrated graphics drivers + # AMD open source graphics drivers only extraPackages = with pkgs; [ amdvlk # AMD Vulkan driver - rocmPackages.clr.icd # OpenCL support + # Removed ROCm packages for simpler configuration ]; - # 32-bit support for compatibility - extraPackages32 = with pkgs.driversi686Linux; [ - amdvlk - ]; + # No 32-bit support packages needed }; # Bluetooth support for Intel AX200 @@ -81,6 +90,15 @@ }; }; + # Additional services for touchpad support + services.udev.extraRules = '' + # ITE8353 touchpad support + SUBSYSTEM=="i2c", KERNEL=="i2c-ITE8353:00", MODE="0664", GROUP="input" + SUBSYSTEM=="input", ATTRS{name}=="ITE8353:00*", MODE="0664", GROUP="input" + # Additional HID rules for touchpads + KERNEL=="hidraw*", ATTRS{idVendor}=="048d", ATTRS{idProduct}=="8353", MODE="0664", GROUP="input" + ''; + # Power management for AMD Ryzen 7 4700U powerManagement = { enable = true; @@ -106,6 +124,10 @@ boot.kernelParams = [ # Enable AMD graphics performance "amdgpu.ppfeaturemask=0xffffffff" + # I2C HID touchpad parameters + "i2c_hid.debug=1" + # Ensure ACPI devices are properly detected + "acpi_enforce_resources=lax" ]; # TLP for better power management (alternative to power-profiles-daemon) diff --git a/modules/desktop/input.nix b/modules/desktop/input.nix new file mode 100644 index 0000000..3f7d8ee --- /dev/null +++ b/modules/desktop/input.nix @@ -0,0 +1,54 @@ +# Input Configuration Module +# Handles touchpad, keyboard, and other input devices +{ + config, + lib, + pkgs, + ... +}: { + # Enable libinput for touchpad support + # This is the recommended touchpad driver for NixOS since 17.09 + services.libinput = { + enable = true; + + # Touchpad-specific settings + touchpad = { + # Enable tap-to-click (can be disabled if unwanted) + tapping = true; + + # Enable two-finger scrolling + scrollMethod = "twofinger"; + + # Enable natural scrolling (macOS-style, disable if you prefer traditional) + naturalScrolling = false; + + # Disable touchpad while typing to prevent accidental input + disableWhileTyping = true; + + # Middle button emulation (three-finger tap) + middleEmulation = true; + }; + + # Mouse settings (for external mice) + mouse = { + # Standard settings for mice + naturalScrolling = false; + accelProfile = "adaptive"; + }; + }; + + # Additional input packages that might be useful + environment.systemPackages = with pkgs; [ + # Input device utilities + libinput-gestures # For custom touchpad gestures + evtest # For testing input devices + xinput # X11 input device utility (still useful in Wayland) + ]; + + # Enable support for additional input methods if needed + # (This is separate from touchpad functionality) + i18n.inputMethod = { + enable = false; # Set to true if you need input methods for other languages + # type = "ibus"; # Uncomment and configure if needed + }; +} diff --git a/scripts/diagnose-trackpad.sh b/scripts/diagnose-trackpad.sh new file mode 100755 index 0000000..022bac1 --- /dev/null +++ b/scripts/diagnose-trackpad.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +# Trackpad Diagnostic Script for Little-Rascal +# This script helps diagnose trackpad issues on NixOS + +echo "=== Little-Rascal Trackpad Diagnostics ===" +echo "Date: $(date)" +echo + +echo "1. Checking for input devices..." +if command -v libinput >/dev/null 2>&1; then + echo " ✓ libinput is available" + echo " Input devices detected by libinput:" + sudo libinput list-devices | grep -E "(Device:|Capabilities:)" | head -20 +else + echo " ✗ libinput not found - this could be the problem!" +fi +echo + +echo "2. Checking systemd services..." +if systemctl is-active --quiet systemd-logind; then + echo " ✓ systemd-logind is running" +else + echo " ✗ systemd-logind is not running" +fi +echo + +echo "3. Checking for trackpad hardware..." +if ls /dev/input/mouse* >/dev/null 2>&1; then + echo " ✓ Mouse devices found:" + ls -la /dev/input/mouse* +else + echo " ⚠ No mouse devices found in /dev/input/" +fi + +if ls /dev/input/event* >/dev/null 2>&1; then + echo " ✓ Event devices found:" + ls -la /dev/input/event* | wc -l + echo " Total event devices: $(ls /dev/input/event* | wc -l)" +else + echo " ✗ No event devices found" +fi +echo + +echo "4. Checking kernel modules..." +modules=("i2c_hid" "hid_multitouch" "psmouse") +for module in "${modules[@]}"; do + if lsmod | grep -q "$module"; then + echo " ✓ $module module is loaded" + else + echo " ⚠ $module module not loaded (may not be needed)" + fi +done +echo + +echo "5. Checking for specific laptop touchpad info..." +if command -v dmesg >/dev/null 2>&1; then + echo " Recent touchpad-related kernel messages:" + dmesg | grep -i -E "(touchpad|synaptics|elan|input)" | tail -5 +fi +echo + +echo "6. User permissions..." +echo " Current user: $(whoami)" +echo " User groups: $(groups)" +if groups | grep -q input; then + echo " ✓ User is in 'input' group" +else + echo " ⚠ User not in 'input' group (usually not required on NixOS)" +fi +echo + +echo "=== Recommendations ===" +echo "If trackpad still doesn't work after enabling libinput:" +echo "1. Reboot the system to ensure all changes take effect" +echo "2. Try: sudo libinput debug-events (to see if events are being detected)" +echo "3. Check dmesg for hardware detection issues" +echo "4. Consider adding specific kernel modules if hardware isn't detected" +echo + +echo "=== Configuration Status ===" +if grep -q "services.libinput.enable.*true" /etc/nixos/configuration.nix 2>/dev/null; then + echo " ✓ libinput appears to be enabled in configuration" +else + echo " ⚠ libinput may not be enabled - check your NixOS configuration" +fi