1{ config, lib, ... }:
2
3with lib;
4let
5 cfg = config.hardware.xpadneo;
6in
7{
8 options.hardware.xpadneo = {
9 enable = mkEnableOption "the xpadneo driver for Xbox One wireless controllers";
10 };
11
12 config = mkIf cfg.enable {
13 boot = {
14 # Must disable Enhanced Retransmission Mode to support bluetooth pairing
15 # https://wiki.archlinux.org/index.php/Gamepad#Connect_Xbox_Wireless_Controller_with_Bluetooth
16 extraModprobeConfig =
17 mkIf
18 (config.hardware.bluetooth.enable &&
19 (lib.versionOlder config.boot.kernelPackages.kernel.version "5.12"))
20 "options bluetooth disable_ertm=1";
21
22 extraModulePackages = with config.boot.kernelPackages; [ xpadneo ];
23 kernelModules = [ "hid_xpadneo" ];
24 };
25 };
26
27 meta = {
28 maintainers = with maintainers; [ kira-bruneau ];
29 };
30}