2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
2020-10-27 00:29:36 +00:00
|
|
|
, lib
|
2021-12-30 13:39:12 +00:00
|
|
|
, buildPackages
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitLab
|
2023-02-02 18:25:31 +00:00
|
|
|
, fetchpatch
|
2021-06-28 23:13:55 +00:00
|
|
|
, python3
|
2020-04-24 23:36:52 +00:00
|
|
|
, meson
|
|
|
|
, ninja
|
2022-06-26 10:26:21 +00:00
|
|
|
, eudev
|
2020-10-27 00:29:36 +00:00
|
|
|
, systemd
|
2022-06-26 10:26:21 +00:00
|
|
|
, enableSystemd ? true
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2021-09-18 10:52:07 +00:00
|
|
|
, docutils
|
2020-04-24 23:36:52 +00:00
|
|
|
, doxygen
|
|
|
|
, graphviz
|
|
|
|
, glib
|
|
|
|
, dbus
|
2021-06-28 23:13:55 +00:00
|
|
|
, alsa-lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, libjack2
|
2021-07-14 22:03:04 +00:00
|
|
|
, libusb1
|
2020-04-24 23:36:52 +00:00
|
|
|
, udev
|
|
|
|
, libsndfile
|
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
2021-06-28 23:13:55 +00:00
|
|
|
, webrtc-audio-processing
|
2023-10-09 19:29:22 +00:00
|
|
|
, webrtc-audio-processing_1
|
2021-02-17 17:02:09 +00:00
|
|
|
, ncurses
|
2022-12-17 10:02:37 +00:00
|
|
|
, readline # meson can't find <7 as those versions don't have a .pc file
|
2022-01-03 16:56:52 +00:00
|
|
|
, lilv
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeFontsConf
|
2020-10-27 00:29:36 +00:00
|
|
|
, callPackage
|
|
|
|
, nixosTests
|
2021-12-19 01:06:50 +00:00
|
|
|
, withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind
|
|
|
|
, valgrind
|
2021-10-04 12:37:57 +00:00
|
|
|
, libcameraSupport ? true
|
|
|
|
, libcamera
|
|
|
|
, libdrm
|
2021-09-18 10:52:07 +00:00
|
|
|
, gstreamerSupport ? true
|
2021-12-19 01:06:50 +00:00
|
|
|
, gst_all_1
|
2021-09-18 10:52:07 +00:00
|
|
|
, ffmpegSupport ? true
|
2021-12-19 01:06:50 +00:00
|
|
|
, ffmpeg
|
2021-09-18 10:52:07 +00:00
|
|
|
, bluezSupport ? true
|
2021-12-19 01:06:50 +00:00
|
|
|
, bluez
|
|
|
|
, sbc
|
|
|
|
, libfreeaptx
|
2022-10-30 15:09:59 +00:00
|
|
|
, liblc3
|
2021-12-19 01:06:50 +00:00
|
|
|
, fdk_aac
|
2022-09-30 11:47:45 +00:00
|
|
|
, libopus
|
2023-10-09 19:29:22 +00:00
|
|
|
, ldacbtSupport ? bluezSupport && lib.meta.availableOn stdenv.hostPlatform ldacbt
|
|
|
|
, ldacbt
|
2020-10-27 00:29:36 +00:00
|
|
|
, nativeHspSupport ? true
|
2021-02-17 17:02:09 +00:00
|
|
|
, nativeHfpSupport ? true
|
2023-04-12 12:48:02 +00:00
|
|
|
, nativeModemManagerSupport ? true
|
|
|
|
, modemmanager
|
2020-10-27 00:29:36 +00:00
|
|
|
, ofonoSupport ? true
|
2020-12-07 07:45:13 +00:00
|
|
|
, hsphfpdSupport ? true
|
2021-09-18 10:52:07 +00:00
|
|
|
, pulseTunnelSupport ? true
|
2021-12-19 01:06:50 +00:00
|
|
|
, libpulseaudio
|
2021-09-18 10:52:07 +00:00
|
|
|
, zeroconfSupport ? true
|
2021-12-19 01:06:50 +00:00
|
|
|
, avahi
|
2022-02-10 20:34:41 +00:00
|
|
|
, raopSupport ? true
|
|
|
|
, openssl
|
2022-01-07 04:07:37 +00:00
|
|
|
, rocSupport ? true
|
|
|
|
, roc-toolkit
|
2022-02-10 20:34:41 +00:00
|
|
|
, x11Support ? true
|
|
|
|
, libcanberra
|
|
|
|
, xorg
|
2023-03-04 12:14:45 +00:00
|
|
|
, mysofaSupport ? true
|
|
|
|
, libmysofa
|
2023-03-27 19:17:25 +00:00
|
|
|
, tinycompress
|
2023-07-15 17:15:38 +00:00
|
|
|
, ffadoSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
|
|
|
, ffado
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# Bluetooth codec only makes sense if general bluetooth enabled
|
|
|
|
assert ldacbtSupport -> bluezSupport;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
2022-01-13 20:06:32 +00:00
|
|
|
mesonEnableFeature = b: if b then "enabled" else "disabled";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
self = stdenv.mkDerivation rec {
|
|
|
|
pname = "pipewire";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.3.80";
|
2021-02-17 17:02:09 +00:00
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"lib"
|
|
|
|
"pulse"
|
|
|
|
"jack"
|
|
|
|
"dev"
|
|
|
|
"doc"
|
2021-09-18 10:52:07 +00:00
|
|
|
"man"
|
2021-02-17 17:02:09 +00:00
|
|
|
"installedTests"
|
|
|
|
];
|
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "gitlab.freedesktop.org";
|
|
|
|
owner = "pipewire";
|
|
|
|
repo = "pipewire";
|
|
|
|
rev = version;
|
2023-10-09 19:29:22 +00:00
|
|
|
sha256 = "sha256-6Ka83Bqd/nsfp8rv0GTBerpGP226MeZvC5u/j62FzP0=";
|
2020-10-27 00:29:36 +00:00
|
|
|
};
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
patches = [
|
|
|
|
# Break up a dependency cycle between outputs.
|
2021-03-09 03:18:52 +00:00
|
|
|
./0040-alsa-profiles-use-libdir.patch
|
2021-02-17 17:02:09 +00:00
|
|
|
# Change the path of the pipewire-pulse binary in the service definition.
|
2021-03-09 03:18:52 +00:00
|
|
|
./0050-pipewire-pulse-path.patch
|
2023-05-24 13:37:59 +00:00
|
|
|
# Load libjack from a known location
|
|
|
|
./0060-libjack-path.patch
|
2021-03-09 03:18:52 +00:00
|
|
|
# Move installed tests into their own output.
|
|
|
|
./0070-installed-tests-path.patch
|
2021-06-28 23:13:55 +00:00
|
|
|
# Add option for changing the config install directory
|
2021-03-09 03:18:52 +00:00
|
|
|
./0080-pipewire-config-dir.patch
|
2021-06-28 23:13:55 +00:00
|
|
|
# Remove output paths from the comments in the config templates to break dependency cycles
|
|
|
|
./0090-pipewire-config-template-paths.patch
|
2021-10-04 12:37:57 +00:00
|
|
|
# Place SPA data files in lib output to avoid dependency cycles
|
|
|
|
./0095-spa-data-dir.patch
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
# backport fix for building with webrtc-audio-processing 0.3 on platforms where we don't have 1.x
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/1f1c308c9766312e684f0b53fc2d1422c7414d31.patch";
|
|
|
|
hash = "sha256-ECM7/84G99yzXsg5A2DkFnXFGJSV9lz3vD0IRSzR8vU=";
|
|
|
|
})
|
2021-02-17 17:02:09 +00:00
|
|
|
];
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
strictDeps = true;
|
2021-02-17 17:02:09 +00:00
|
|
|
nativeBuildInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
docutils
|
2021-02-17 17:02:09 +00:00
|
|
|
doxygen
|
|
|
|
graphviz
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
2021-06-28 23:13:55 +00:00
|
|
|
python3
|
2023-02-16 17:41:37 +00:00
|
|
|
glib
|
2021-02-17 17:02:09 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
alsa-lib
|
2021-02-17 17:02:09 +00:00
|
|
|
dbus
|
|
|
|
glib
|
|
|
|
libjack2
|
2021-07-14 22:03:04 +00:00
|
|
|
libusb1
|
2021-02-17 17:02:09 +00:00
|
|
|
libsndfile
|
2022-01-03 16:56:52 +00:00
|
|
|
lilv
|
2021-02-17 17:02:09 +00:00
|
|
|
ncurses
|
2022-12-17 10:02:37 +00:00
|
|
|
readline
|
2021-02-17 17:02:09 +00:00
|
|
|
udev
|
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
2023-03-27 19:17:25 +00:00
|
|
|
tinycompress
|
2022-06-26 10:26:21 +00:00
|
|
|
] ++ (if enableSystemd then [ systemd ] else [ eudev ])
|
2023-10-09 19:29:22 +00:00
|
|
|
++ (if lib.meta.availableOn stdenv.hostPlatform webrtc-audio-processing_1 then [ webrtc-audio-processing_1 ] else [ webrtc-audio-processing ])
|
2022-06-26 10:26:21 +00:00
|
|
|
++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ]
|
2021-10-04 12:37:57 +00:00
|
|
|
++ lib.optionals libcameraSupport [ libcamera libdrm ]
|
2021-02-17 17:02:09 +00:00
|
|
|
++ lib.optional ffmpegSupport ffmpeg
|
2023-10-09 19:29:22 +00:00
|
|
|
++ lib.optionals bluezSupport [ bluez libfreeaptx liblc3 sbc fdk_aac libopus ]
|
|
|
|
++ lib.optional ldacbtSupport ldacbt
|
2023-04-12 12:48:02 +00:00
|
|
|
++ lib.optional nativeModemManagerSupport modemmanager
|
2021-06-28 23:13:55 +00:00
|
|
|
++ lib.optional pulseTunnelSupport libpulseaudio
|
2022-01-07 04:07:37 +00:00
|
|
|
++ lib.optional zeroconfSupport avahi
|
2022-02-10 20:34:41 +00:00
|
|
|
++ lib.optional raopSupport openssl
|
|
|
|
++ lib.optional rocSupport roc-toolkit
|
2023-03-04 12:14:45 +00:00
|
|
|
++ lib.optionals x11Support [ libcanberra xorg.libX11 xorg.libXfixes ]
|
2023-07-15 17:15:38 +00:00
|
|
|
++ lib.optional mysofaSupport libmysofa
|
|
|
|
++ lib.optional ffadoSupport ffado;
|
2021-02-17 17:02:09 +00:00
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
# Valgrind binary is required for running one optional test.
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = lib.optional withValgrind valgrind;
|
2021-12-19 01:06:50 +00:00
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
mesonFlags = [
|
2021-03-23 19:22:30 +00:00
|
|
|
"-Ddocs=enabled"
|
2021-02-17 17:02:09 +00:00
|
|
|
"-Dudevrulesdir=lib/udev/rules.d"
|
2021-03-23 19:22:30 +00:00
|
|
|
"-Dinstalled_tests=enabled"
|
2021-02-17 17:02:09 +00:00
|
|
|
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
|
|
|
|
"-Dpipewire_pulse_prefix=${placeholder "pulse"}"
|
|
|
|
"-Dlibjack-path=${placeholder "jack"}/lib"
|
2022-08-12 12:06:08 +00:00
|
|
|
"-Dlibv4l2-path=${placeholder "out"}/lib"
|
2022-01-13 20:06:32 +00:00
|
|
|
"-Dlibcamera=${mesonEnableFeature libcameraSupport}"
|
2023-07-15 17:15:38 +00:00
|
|
|
"-Dlibffado=${mesonEnableFeature ffadoSupport}"
|
2022-01-13 20:06:32 +00:00
|
|
|
"-Droc=${mesonEnableFeature rocSupport}"
|
|
|
|
"-Dlibpulse=${mesonEnableFeature pulseTunnelSupport}"
|
|
|
|
"-Davahi=${mesonEnableFeature zeroconfSupport}"
|
|
|
|
"-Dgstreamer=${mesonEnableFeature gstreamerSupport}"
|
2022-06-26 10:26:21 +00:00
|
|
|
"-Dsystemd-system-service=${mesonEnableFeature enableSystemd}"
|
|
|
|
"-Dudev=${mesonEnableFeature (!enableSystemd)}"
|
|
|
|
"-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d"
|
2022-01-13 20:06:32 +00:00
|
|
|
"-Dffmpeg=${mesonEnableFeature ffmpegSupport}"
|
|
|
|
"-Dbluez5=${mesonEnableFeature bluezSupport}"
|
|
|
|
"-Dbluez5-backend-hsp-native=${mesonEnableFeature nativeHspSupport}"
|
|
|
|
"-Dbluez5-backend-hfp-native=${mesonEnableFeature nativeHfpSupport}"
|
2023-04-12 12:48:02 +00:00
|
|
|
"-Dbluez5-backend-native-mm=${mesonEnableFeature nativeModemManagerSupport}"
|
2022-01-13 20:06:32 +00:00
|
|
|
"-Dbluez5-backend-ofono=${mesonEnableFeature ofonoSupport}"
|
|
|
|
"-Dbluez5-backend-hsphfpd=${mesonEnableFeature hsphfpdSupport}"
|
2023-04-12 12:48:02 +00:00
|
|
|
# source code is not easily obtainable
|
2022-06-26 10:26:21 +00:00
|
|
|
"-Dbluez5-codec-lc3plus=disabled"
|
2022-10-30 15:09:59 +00:00
|
|
|
"-Dbluez5-codec-lc3=${mesonEnableFeature bluezSupport}"
|
2023-10-09 19:29:22 +00:00
|
|
|
"-Dbluez5-codec-ldac=${mesonEnableFeature ldacbtSupport}"
|
2021-06-28 23:13:55 +00:00
|
|
|
"-Dsysconfdir=/etc"
|
|
|
|
"-Dpipewire_confdata_dir=${placeholder "lib"}/share/pipewire"
|
2022-02-10 20:34:41 +00:00
|
|
|
"-Draop=${mesonEnableFeature raopSupport}"
|
2021-12-06 16:07:01 +00:00
|
|
|
"-Dsession-managers="
|
|
|
|
"-Dvulkan=enabled"
|
2022-02-10 20:34:41 +00:00
|
|
|
"-Dx11=${mesonEnableFeature x11Support}"
|
2023-05-24 13:37:59 +00:00
|
|
|
"-Dx11-xfixes=${mesonEnableFeature x11Support}"
|
|
|
|
"-Dlibcanberra=${mesonEnableFeature x11Support}"
|
2023-03-04 12:14:45 +00:00
|
|
|
"-Dlibmysofa=${mesonEnableFeature mysofaSupport}"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-Dsdl2=disabled" # required only to build examples, causes dependency loop
|
2023-03-04 12:14:45 +00:00
|
|
|
"-Drlimits-install=false" # installs to /etc, we won't use this anyway
|
2023-03-27 19:17:25 +00:00
|
|
|
"-Dcompress-offload=enabled"
|
2021-02-17 17:02:09 +00:00
|
|
|
];
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
# Fontconfig error: Cannot load default config file
|
|
|
|
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
|
2021-02-17 17:02:09 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
postUnpack = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
patchShebangs source/doc/input-filter.sh
|
|
|
|
patchShebangs source/doc/input-filter-h.sh
|
2021-06-28 23:13:55 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
postInstall = ''
|
2022-06-26 10:26:21 +00:00
|
|
|
${lib.optionalString enableSystemd ''
|
|
|
|
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
|
|
|
|
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
|
|
|
|
''}
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
rm $out/bin/pipewire-pulse
|
|
|
|
mkdir -p $pulse/bin
|
|
|
|
ln -sf $out/bin/pipewire $pulse/bin/pipewire-pulse
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
moveToOutput "bin/pw-jack" "$jack"
|
2021-02-17 17:02:09 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru.tests.installed-tests = nixosTests.installed-tests.pipewire;
|
2021-02-17 17:02:09 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Server and user space API to deal with multimedia pipelines";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${version}";
|
2021-02-17 17:02:09 +00:00
|
|
|
homepage = "https://pipewire.org/";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux;
|
2023-05-24 13:37:59 +00:00
|
|
|
maintainers = with maintainers; [ kranzes k900 ];
|
2021-02-17 17:02:09 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-02-17 17:02:09 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
in
|
|
|
|
self
|