From 370060f75e5b3088e220c8385d4f9aab63c376cf Mon Sep 17 00:00:00 2001 From: Myned Date: Fri, 10 Jan 2025 16:01:00 -0600 Subject: [PATCH] nix: make pulseaudio options version-dependent Signed-off-by: Myned --- options/custom/services/pipewire.nix | 62 ++++++++++++++++------------ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/options/custom/services/pipewire.nix b/options/custom/services/pipewire.nix index f4f2c4c..cadad1c 100644 --- a/options/custom/services/pipewire.nix +++ b/options/custom/services/pipewire.nix @@ -8,35 +8,45 @@ with lib; let in { options.custom.services.pipewire.enable = mkOption {default = false;}; - config = mkIf cfg.enable { - #!! Realtime priority may cause desync - #// security.rtkit.enable = true; + config = mkIf cfg.enable ({ + #!! Realtime priority may cause desync + #// security.rtkit.enable = true; - services = { - pulseaudio.enable = false; + services = { + # https://wiki.nixos.org/wiki/PipeWire + # https://gitlab.freedesktop.org/pipewire/pipewire + pipewire = { + enable = true; + pulse.enable = true; - # https://wiki.nixos.org/wiki/PipeWire - # https://gitlab.freedesktop.org/pipewire/pipewire - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; + alsa = { + enable = true; + support32Bit = true; + }; - # Avoid resampling if possible - # https://wiki.archlinux.org/title/PipeWire#Changing_the_allowed_sample_rate(s) - extraConfig.pipewire = { - "10-sample-rate"."context.properties"."default.clock.allowed-rates" = [ - 32000 - 44100 - 48000 - 88200 - 96000 - 176400 - 192000 - ]; + # Avoid resampling if possible + # https://wiki.archlinux.org/title/PipeWire#Changing_the_allowed_sample_rate(s) + extraConfig.pipewire = { + "10-sample-rate"."context.properties"."default.clock.allowed-rates" = [ + 32000 + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + }; }; }; - }; - }; + } + // ( + if versionAtLeast version "25.05" + then { + services.pulseaudio.enable = false; + } + else { + hardware.pulseaudio.enable = false; + } + )); }