Skip to content

Commit

Permalink
steamdeck/sound: use wireplumber-jovian + Valve DSP confs, drop pulse…
Browse files Browse the repository at this point in the history
… support
  • Loading branch information
K900 committed Nov 15, 2023
1 parent 7a2a30a commit ff550cf
Showing 1 changed file with 24 additions and 39 deletions.
63 changes: 24 additions & 39 deletions modules/steamdeck/sound.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
}

0 comments on commit ff550cf

Please sign in to comment.