2024-05-07 22:02:59 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-02-29 14:53:34 +00:00
|
|
|
|
|
|
|
# Gaming-related settings
|
|
|
|
let
|
2024-05-07 22:02:59 +00:00
|
|
|
cfg = config.host.apps.gaming;
|
2024-05-12 00:29:29 +00: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-02-29 14:53:34 +00:00
|
|
|
in
|
|
|
|
with lib;
|
|
|
|
{
|
2024-05-07 22:02:59 +00:00
|
|
|
options = {
|
|
|
|
host.apps.gaming.enable = mkEnableOption (mdDoc "Enables gaming features");
|
|
|
|
};
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-05-07 22:02:59 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
host.ui.flatpak.enable = true;
|
|
|
|
services.flatpak.packages = [
|
|
|
|
"gg.minion.Minion"
|
|
|
|
"com.valvesoftware.Steam"
|
|
|
|
"org.firestormviewer.FirestormViewer"
|
|
|
|
];
|
2024-03-11 16:27:30 +00:00
|
|
|
|
2024-05-07 22:02:59 +00:00
|
|
|
# Enable Xbox controller driver (XPadNeo)
|
|
|
|
boot = {
|
|
|
|
extraModulePackages = with config.boot.kernelPackages; [ xpadneo ];
|
|
|
|
kernelModules = [ "hid_xpadneo" ];
|
|
|
|
};
|
2024-05-12 00:29:29 +00:00
|
|
|
|
|
|
|
# Add script to restart xpadneo in case of issues
|
|
|
|
environment.systemPackages = [ reset-controllers-script ];
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
2024-02-29 14:53:34 +00:00
|
|
|
}
|