From ff550cf64569829073b30d7f16f0f352e48050fa Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 15 Nov 2023 12:08:21 +0300 Subject: [PATCH] steamdeck/sound: use wireplumber-jovian + Valve DSP confs, drop pulse support --- modules/steamdeck/sound.nix | 63 ++++++++++++++----------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/modules/steamdeck/sound.nix b/modules/steamdeck/sound.nix index 3ea14bfc..8d76d8bd 100644 --- a/modules/steamdeck/sound.nix +++ b/modules/steamdeck/sound.nix @@ -27,47 +27,32 @@ in }; }; - config = lib.mkIf (cfg.enableSoundSupport) (lib.mkMerge [ - { - hardware.pulseaudio.enable = lib.mkDefault false; + config = let + systemWide = config.services.pipewire.systemWide; - services.pipewire = { - enable = lib.mkDefault true; - pulse.enable = lib.mkDefault true; - alsa.enable = lib.mkDefault true; - }; + extraEnv = { + ALSA_CONFIG_UCM2 = "${alsa-ucm-conf'}/share/alsa/ucm2"; + LV2_PATH = "${pkgs.steamdeck-dsp}/lib/lv2"; + }; + in lib.mkIf cfg.enableSoundSupport { + hardware.pulseaudio.enable = false; + + services.pipewire = { + enable = true; + pulse.enable = true; + alsa.enable = true; + wireplumber.package = pkgs.wireplumber-jovian; + }; - environment.variables.ALSA_CONFIG_UCM2 = "${alsa-ucm-conf'}/share/alsa/ucm2"; - } + environment.etc."pipewire/pipewire.conf.d".source = "${pkgs.steamdeck-dsp}/share/pipewire/pipewire.conf.d"; + environment.etc."wireplumber".source = "${pkgs.steamdeck-dsp}/share/wireplumber"; - # Pulseaudio - (lib.mkIf (config.hardware.pulseaudio.enable) (let - systemWide = config.hardware.pulseaudio.systemWide; - in { - systemd.services.pulseaudio = lib.mkIf systemWide { - environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; - }; - systemd.user.services.pulseaudio = lib.mkIf (!systemWide) { - environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; - }; - })) + environment.variables = extraEnv; + + systemd.services.pipewire.environment = lib.mkIf systemWide extraEnv; + systemd.user.services.pipewire.environment = lib.mkIf (!systemWide) extraEnv; - # Pipewire - (lib.mkIf (config.services.pipewire.enable) (let - systemWide = config.services.pipewire.systemWide; - in { - systemd.services.pipewire = lib.mkIf systemWide { - environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; - }; - systemd.user.services.pipewire = lib.mkIf (!systemWide) { - environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; - }; - systemd.services.wireplumber = lib.mkIf systemWide { - environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; - }; - systemd.user.services.wireplumber = lib.mkIf (!systemWide) { - environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2; - }; - })) - ]); + systemd.services.wireplumber.environment = lib.mkIf systemWide extraEnv; + systemd.user.services.wireplumber.environment = lib.mkIf (!systemWide) extraEnv; + }; }