Commit 753d94e

HPCesia <me@hpcesia.com>
2026-10-05 15:48:50
gamepad: move dualsense fix to game.gamepad
1 parent 6d2b762
Changed files (2)
modules
desktop
modules/desktop/game/gamepad.nix
@@ -3,21 +3,44 @@
   den.aspects.desktop.game.gamepad = {
     nixos = {
       pkgs,
+      lib,
       config,
       ...
-    }: {
+    }: let
+      # Fix DualSense haptics until https://github.com/alsa-project/alsa-ucm-conf/issues/677 been resolved.
+      alsa-ucm-conf-dualsense-haptics = with pkgs;
+        alsa-ucm-conf.overrideAttrs {
+          # https://github.com/alsa-project/alsa-ucm-conf/issues/677#issuecomment-3759801501
+          patches = [
+            ./alsa-ucm-dualsense-haptics.patch
+          ];
+        };
+    in {
       hardware = {
         uinput.enable = true;
         xone.enable = true;
         xpadneo.enable = true;
       };
 
+      environment.sessionVariables.ALSA_CONFIG_UCM2 = "${alsa-ucm-conf-dualsense-haptics}/share/alsa/ucm2";
+
       boot = {
         extraModulePackages = [
           config.boot.kernelPackages.xpadneo
         ];
         extraModprobeConfig = ''
           options bluetooth disable_ertm=Y
+          ${
+            # Linux 7.1-7.2 sticky-mixer detection falsely hides the DualSense "PCM Playback Volume"
+            # that haptics need at 100%.
+            # NOTE: 7.3 demotes the check and flips the flag to MIXER_GET_CUR_OK.
+            let
+              kernelVersion = lib.getVersion config.boot.kernelPackages.kernel;
+            in
+              lib.optionalString
+              (lib.versionAtLeast kernelVersion "7.1" && lib.versionOlder kernelVersion "7.3")
+              "options snd_usb_audio quirk_flags=054c:0ce6:MIXER_GET_CUR_BROKEN, 054c:0df2:MIXER_GET_CUR_BROKEN"
+          }
         '';
         kernelModules = [
           "hid_microsoft"
modules/desktop/game/misc.nix
@@ -1,32 +1,7 @@
 {den, ...}: {
   den.aspects.desktop.game.includes = [den.aspects.desktop.game.misc];
   den.aspects.desktop.game.misc = {
-    nixos = {
-      pkgs,
-      lib,
-      config,
-      ...
-    }: let
-      # Fix DualSense haptics until https://github.com/alsa-project/alsa-ucm-conf/issues/677 been resolved.
-      alsa-ucm-conf-dualsense-haptics = with pkgs;
-        alsa-ucm-conf.overrideAttrs {
-          # https://github.com/alsa-project/alsa-ucm-conf/issues/677#issuecomment-3759801501
-          patches = [
-            ./alsa-ucm-dualsense-haptics.patch
-          ];
-        };
-    in {
-      environment.sessionVariables.ALSA_CONFIG_UCM2 = "${alsa-ucm-conf-dualsense-haptics}/share/alsa/ucm2";
-      # Linux 7.1-7.2 sticky-mixer detection falsely hides the DualSense "PCM Playback Volume"
-      # that haptics need at 100%.
-      # NOTE: 7.3 demotes the check and flips the flag to MIXER_GET_CUR_OK.
-      boot.extraModprobeConfig = let
-        kernelVersion = lib.getVersion config.boot.kernelPackages.kernel;
-      in
-        lib.mkIf
-        (lib.versionAtLeast kernelVersion "7.1" && lib.versionOlder kernelVersion "7.3")
-        "options snd_usb_audio quirk_flags=054c:0ce6:MIXER_GET_CUR_BROKEN, 054c:0df2:MIXER_GET_CUR_BROKEN";
-
+    nixos = {pkgs, ...}: {
       programs.gamemode.enable = true;
 
       # load ntsync