diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix index fa39594d2589..63423b756681 100644 --- a/pkgs/development/libraries/pipewire/default.nix +++ b/pkgs/development/libraries/pipewire/default.nix @@ -6,9 +6,12 @@ python3, meson, ninja, + freebsd, elogind, + libinotify-kqueue, + epoll-shim, systemd, - enableSystemd ? true, # enableSystemd=false maintained by maintainers.qyliss. + enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, # enableSystemd=false maintained by maintainers.qyliss. pkg-config, docutils, doxygen, @@ -55,7 +58,10 @@ libcanberra, xorg, libmysofa, - ffadoSupport ? x11Support && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform, + ffadoSupport ? + x11Support + && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform + && lib.meta.availableOn stdenv.hostPlatform ffado, ffado, libselinux, libebur128, @@ -66,6 +72,11 @@ let webrtc-audio-processing_1 webrtc-audio-processing ]; + + bluezSupport = stdenv.hostPlatform.isLinux; + modemmanagerSupport = lib.meta.availableOn stdenv.hostPlatform modemmanager; + libcameraSupport = lib.meta.availableOn stdenv.hostPlatform libcamera; + ldacbtSupport = lib.meta.availableOn stdenv.hostPlatform ldacbt; in stdenv.mkDerivation (finalAttrs: { @@ -111,43 +122,43 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ - alsa-lib - bluez dbus - fdk_aac ffmpeg fftwFloat glib gst_all_1.gst-plugins-base gst_all_1.gstreamer - libcamera libebur128 libjack2 - libfreeaptx - liblc3 libmysofa libopus libpulseaudio libusb1 - libselinux libsndfile lilv - modemmanager ncurses readline - sbc ] ++ ( if enableSystemd then [ systemd ] - else + else if stdenv.hostPlatform.isLinux then [ elogind udev ] + else + [ ] ) + ++ lib.optionals stdenv.hostPlatform.isFreeBSD [ + libinotify-kqueue + epoll-shim + freebsd.libstdthreads + ] ++ lib.take 1 webrtc-audio-processings - ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform ldacbt) ldacbt + ++ lib.optional stdenv.hostPlatform.isLinux alsa-lib + ++ lib.optional ldacbtSupport ldacbt + ++ lib.optional libcameraSupport libcamera ++ lib.optional zeroconfSupport avahi ++ lib.optional raopSupport openssl ++ lib.optional rocSupport roc-toolkit @@ -161,19 +172,30 @@ stdenv.mkDerivation (finalAttrs: { xorg.libX11 xorg.libXfixes ] - ++ lib.optional ffadoSupport ffado; + ++ lib.optionals bluezSupport [ + bluez + libfreeaptx + liblc3 + sbc + fdk_aac + ] + ++ lib.optional ffadoSupport ffado + ++ lib.optional stdenv.hostPlatform.isLinux libselinux + ++ lib.optional modemmanagerSupport modemmanager; # Valgrind binary is required for running one optional test. nativeCheckInputs = lib.optional (lib.meta.availableOn stdenv.hostPlatform valgrind) valgrind; mesonFlags = [ + (lib.mesonEnable "pipewire-alsa" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "alsa" stdenv.hostPlatform.isLinux) (lib.mesonEnable "docs" true) (lib.mesonOption "udevrulesdir" "lib/udev/rules.d") (lib.mesonEnable "installed_tests" true) (lib.mesonOption "installed_test_prefix" (placeholder "installedTests")) (lib.mesonOption "libjack-path" "${placeholder "jack"}/lib") (lib.mesonEnable "echo-cancel-webrtc" (webrtc-audio-processings != [ ])) - (lib.mesonEnable "libcamera" true) + (lib.mesonEnable "libcamera" (lib.meta.availableOn stdenv.hostPlatform libcamera)) (lib.mesonEnable "libffado" ffadoSupport) (lib.mesonEnable "roc" rocSupport) (lib.mesonEnable "libpulse" true) @@ -181,21 +203,26 @@ stdenv.mkDerivation (finalAttrs: { (lib.mesonEnable "gstreamer" true) (lib.mesonEnable "gstreamer-device-provider" true) (lib.mesonOption "logind-provider" (if enableSystemd then "libsystemd" else "libelogind")) + (lib.mesonEnable "logind" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "selinux" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "avb" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "v4l2" stdenv.hostPlatform.isLinux) + (lib.mesonEnable "pipewire-v4l2" stdenv.hostPlatform.isLinux) (lib.mesonEnable "systemd" enableSystemd) (lib.mesonEnable "systemd-system-service" enableSystemd) - (lib.mesonEnable "udev" (!enableSystemd)) + (lib.mesonEnable "udev" (!enableSystemd && stdenv.hostPlatform.isLinux)) (lib.mesonEnable "ffmpeg" true) (lib.mesonEnable "pw-cat-ffmpeg" true) - (lib.mesonEnable "bluez5" true) - (lib.mesonEnable "bluez5-backend-hsp-native" true) - (lib.mesonEnable "bluez5-backend-hfp-native" true) - (lib.mesonEnable "bluez5-backend-native-mm" true) - (lib.mesonEnable "bluez5-backend-ofono" true) - (lib.mesonEnable "bluez5-backend-hsphfpd" true) + (lib.mesonEnable "bluez5" bluezSupport) + (lib.mesonEnable "bluez5-backend-hsp-native" bluezSupport) + (lib.mesonEnable "bluez5-backend-hfp-native" bluezSupport) + (lib.mesonEnable "bluez5-backend-native-mm" bluezSupport) + (lib.mesonEnable "bluez5-backend-ofono" bluezSupport) + (lib.mesonEnable "bluez5-backend-hsphfpd" bluezSupport) # source code is not easily obtainable (lib.mesonEnable "bluez5-codec-lc3plus" false) - (lib.mesonEnable "bluez5-codec-lc3" true) - (lib.mesonEnable "bluez5-codec-ldac" (lib.meta.availableOn stdenv.hostPlatform ldacbt)) + (lib.mesonEnable "bluez5-codec-lc3" bluezSupport) + (lib.mesonEnable "bluez5-codec-ldac" (bluezSupport && ldacbtSupport)) (lib.mesonEnable "opus" true) (lib.mesonOption "sysconfdir" "/etc") (lib.mesonEnable "raop" raopSupport) @@ -233,7 +260,7 @@ stdenv.mkDerivation (finalAttrs: { changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${finalAttrs.version}"; homepage = "https://pipewire.org/"; license = licenses.mit; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.freebsd; maintainers = with maintainers; [ kranzes k900