From 0dc0a1aafb0118c65b37d4a947870f3446671d7b Mon Sep 17 00:00:00 2001 From: kB01 Date: Sun, 5 Jan 2025 14:00:36 +0100 Subject: [PATCH] Added Bosto Touchpad Support --- .../nixos/hardware/bosto-touchpad/default.nix | 43 +++++++++++++++++++ systems/x86_64-linux/LoyAdjo/hardware.nix | 9 +++- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 modules/nixos/hardware/bosto-touchpad/default.nix diff --git a/modules/nixos/hardware/bosto-touchpad/default.nix b/modules/nixos/hardware/bosto-touchpad/default.nix new file mode 100644 index 0000000..bf055d9 --- /dev/null +++ b/modules/nixos/hardware/bosto-touchpad/default.nix @@ -0,0 +1,43 @@ +{ + inputs, + config, + lib, + pkgs, + system, + ... +}: +let + cfg = config.hardware.bosto-touchpad; +in +{ + options.hardware.bosto-touchpad.enable = lib.mkOption { + type = with lib.types; uniq bool; + default = false; + description = "Enable Bosto Touchpad Support"; + }; + + config = lib.mkIf (cfg.enable) { + + # boot.kernelModules = [ "hid-magicmouse" ]; + + # Add Driver Options to extra ModprobeConfig, to support reloading hid-magicmouse + boot.extraModprobeConfig = '' + options hid-magicmouse emulate_scroll_wheel=Y emulate_3button=Y middle_click_3finger=Y scroll_acceleration=Y scroll_speed=10 + ''; + + # Service to load Driver with options + systemd.services."bostoService" = { + description = "Bosto Touchpad Service"; + path = [ pkgs.kmod ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = '' + ${pkgs.kmod.out}/bin/modprobe -r hid-magicmouse + ${pkgs.kmod.out}/bin/modprobe hid-magicmouse emulate_scroll_wheel=Y emulate_3button=Y middle_click_3finger=Y scroll_acceleration=Y scroll_speed=10 + ''; + }; + wantedBy = [ "multi-user.target" ]; + }; + }; +} + diff --git a/systems/x86_64-linux/LoyAdjo/hardware.nix b/systems/x86_64-linux/LoyAdjo/hardware.nix index 39f2519..7ed513e 100644 --- a/systems/x86_64-linux/LoyAdjo/hardware.nix +++ b/systems/x86_64-linux/LoyAdjo/hardware.nix @@ -9,8 +9,10 @@ ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; + boot.initrd.kernelModules = []; + boot.kernelModules = [ + "kvm-amd" + ]; boot.extraModulePackages = [ ]; # Setup Nvidia Driver @@ -25,6 +27,9 @@ package = config.boot.kernelPackages.nvidiaPackages.beta; }; + # Enable Bosto Tochpad Support (See ../../../modules/nixos/hardware/bosto-touchpad/default.nix) + hardware.bosto-touchpad.enable = true; + fileSystems."/" = { device = "/dev/disk/by-uuid/b3344eaa-384e-4779-92b8-92f6e9a27d7d"; fsType = "ext4";