firefox: support JACK and sndio audio backends

You can set `media.cubeb.backend` in `about:config` to force a specific
backend.
This commit is contained in:
S. Nordin Abouzahra 2022-05-07 18:31:10 -04:00
parent 7907a7ac15
commit 0bafb3baa7
2 changed files with 14 additions and 0 deletions

View File

@ -80,11 +80,13 @@
, alsaSupport ? stdenv.isLinux, alsa-lib
, ffmpegSupport ? true
, gssSupport ? true, libkrb5
, jackSupport ? stdenv.isLinux, libjack2
, jemallocSupport ? true, jemalloc
, ltoSupport ? (stdenv.isLinux && stdenv.is64bit), overrideCC, buildPackages
, pgoSupport ? (stdenv.isLinux && stdenv.isx86_64 && stdenv.hostPlatform == stdenv.buildPlatform), xvfb-run
, pipewireSupport ? waylandSupport && webrtcSupport
, pulseaudioSupport ? stdenv.isLinux, libpulseaudio
, sndioSupport ? stdenv.isLinux, sndio
, waylandSupport ? true, libxkbcommon, libdrm
## privacy-related options
@ -303,7 +305,9 @@ buildStdenv.mkDerivation ({
++ lib.optional (lib.versionAtLeast version "95") "--with-wasi-sysroot=${wasiSysRoot}"
++ flag alsaSupport "alsa"
++ flag jackSupport "jack"
++ flag pulseaudioSupport "pulseaudio"
++ lib.optional (lib.versionAtLeast version "100") (flag sndioSupport "sndio")
++ flag ffmpegSupport "ffmpeg"
++ flag jemallocSupport "jemalloc"
++ flag geolocationSupport "necko-wifi"
@ -363,7 +367,9 @@ buildStdenv.mkDerivation ({
]
++ [ (if (lib.versionAtLeast version "92") then nss_latest else nss_esr) ]
++ lib.optional alsaSupport alsa-lib
++ lib.optional jackSupport libjack2
++ lib.optional pulseaudioSupport libpulseaudio # only headers are needed
++ lib.optional (sndioSupport && lib.versionAtLeast version "100") sndio
++ lib.optional gssSupport libkrb5
++ lib.optionals waylandSupport [ libxkbcommon libdrm ]
++ lib.optional jemallocSupport jemalloc
@ -464,7 +470,9 @@ buildStdenv.mkDerivation ({
inherit version;
inherit alsaSupport;
inherit binaryName;
inherit jackSupport;
inherit pipewireSupport;
inherit sndioSupport;
inherit nspr;
inherit ffmpegSupport;
inherit gssSupport;

View File

@ -13,6 +13,8 @@
, mesa # firefox wants gbm for drm+dmabuf
, cups
, pciutils
, sndio
, libjack2
}:
## configurability of the wrapper itself
@ -53,6 +55,8 @@ let
gssSupport = browser.gssSupport or false;
alsaSupport = browser.alsaSupport or false;
pipewireSupport = browser.pipewireSupport or false;
sndioSupport = browser.sndioSupport or false;
jackSupport = browser.jackSupport or false;
# PCSC-Lite daemon (services.pcscd) also must be enabled for firefox to access smartcards
smartcardSupport = cfg.smartcardSupport or false;
@ -76,6 +80,8 @@ let
(with xorg; [ stdenv.cc libX11 libXxf86dga libXxf86vm libXext libXt alsa-lib zlib ])
++ lib.optional (config.pulseaudio or true) libpulseaudio
++ lib.optional alsaSupport alsa-lib
++ lib.optional sndioSupport sndio
++ lib.optional jackSupport libjack2
++ lib.optional smartcardSupport opensc
++ pkcs11Modules;
gtk_modules = [ libcanberra-gtk3 ];