2024-05-07 18:02:59 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-02-29 09:53:34 -05:00
|
|
|
|
|
|
|
# Gaming-related settings
|
|
|
|
let
|
2024-06-24 11:38:28 -04:00
|
|
|
cfg = config.aux.system.apps.gaming;
|
2024-05-11 20:29:29 -04:00
|
|
|
reset-controllers-script = pkgs.writeShellScriptBin "reset-controllers" ''
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
sudo rmmod hid_xpadneo && sudo modprobe hid_xpadneo
|
|
|
|
sudo systemctl restart bluetooth.service
|
|
|
|
'';
|
2024-10-24 16:50:21 -04:00
|
|
|
|
|
|
|
# FIXME: replace with real vendorID and product ID for Victrix Pro BFG controller
|
|
|
|
vendorID = "0e6f";
|
|
|
|
productID = "024b";
|
2024-02-29 09:53:34 -05:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 18:02:59 -04:00
|
|
|
options = {
|
2024-08-02 17:55:48 -04:00
|
|
|
aux.system.apps.gaming.enable = lib.mkEnableOption "Enables gaming features";
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-02-29 09:53:34 -05:00
|
|
|
|
2024-08-02 17:55:48 -04:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-06-25 14:13:15 -04:00
|
|
|
aux.system.ui.flatpak = {
|
|
|
|
enable = true;
|
|
|
|
packages = [
|
|
|
|
"gg.minion.Minion"
|
|
|
|
"com.valvesoftware.Steam"
|
|
|
|
"org.firestormviewer.FirestormViewer"
|
|
|
|
];
|
|
|
|
};
|
2024-03-11 12:27:30 -04:00
|
|
|
|
2024-05-07 18:02:59 -04:00
|
|
|
# Enable Xbox controller driver (XPadNeo)
|
2024-06-05 13:42:14 -04:00
|
|
|
hardware.xpadneo.enable = true;
|
2024-05-11 20:29:29 -04:00
|
|
|
|
2024-10-24 16:50:21 -04:00
|
|
|
# Create udev rule to force PDP Victrix controller to use xpadneo
|
|
|
|
# Udev rule taken from https://github.com/atar-axis/xpadneo/blob/master/hid-xpadneo/etc-udev-rules.d/60-xpadneo.rules
|
|
|
|
# Also see https://www.reddit.com/r/linuxquestions/comments/rcx182/why_cant_i_write_to_sysbushiddriversxpadneonew_id/
|
|
|
|
services.udev.extraRules = ''
|
|
|
|
ACTION=="add", ATTRS{id/vendor}==${vendorID}, ATTRS{id/product}==${productID}, RUN+="${pkgs.bash}/bin/bash -c 'echo 0x03 ${vendorID} ${productID} > /sys/bus/hid/drivers/xpadneo/new_id && echo 0x05 ${vendorID} ${productID} > /sys/bus/hid/drivers/xpadneo/new_id'"
|
|
|
|
'';
|
|
|
|
/*
|
|
|
|
services.udev.packages = [
|
|
|
|
(pkgs.writeTextFile {
|
|
|
|
name = "victrix-pro-bfg.rules";
|
|
|
|
executable = true;
|
|
|
|
destination = "/etc/udev/rules.d/70-victrix-pro-bfg.rules";
|
|
|
|
text = ''
|
|
|
|
ACTION=="add", ATTRS{id/vendor}==${vendorID}, ATTRS{id/product}==${productID}, RUN+="${pkgs.bash}/bin/bash -c 'echo 0x03 ${vendorID} ${productID} > /sys/bus/hid/drivers/xpadneo/new_id && echo 0x05 ${vendorID} ${productID} > /sys/bus/hid/drivers/xpadneo/new_id'"
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
];
|
|
|
|
*/
|
|
|
|
|
2024-05-11 20:29:29 -04:00
|
|
|
# Add script to restart xpadneo in case of issues
|
2024-06-25 14:13:15 -04:00
|
|
|
aux.system.packages = [ reset-controllers-script ];
|
2024-07-31 14:20:28 -04:00
|
|
|
|
|
|
|
# Enable GameMode
|
|
|
|
programs.gamemode.enable = true;
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-02-29 09:53:34 -05:00
|
|
|
}
|