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 "options bluetooth disable_ertm=1";
20
21 extraModulePackages = with config.boot.kernelPackages; [ xpadneo ];
22 kernelModules = [ "hid_xpadneo" ];
23 };
24 };
25
26 meta = {
27 maintainers = with maintainers; [ kira-bruneau ];
28 };
29}