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
|
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
|
|
|
|
, ldacbt
|
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
|
2020-10-27 00:29:36 +00:00
|
|
|
, nativeHspSupport ? true
|
2021-02-17 17:02:09 +00:00
|
|
|
, nativeHfpSupport ? true
|
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
|
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-02-02 18:25:31 +00:00
|
|
|
version = "0.3.65";
|
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-02-02 18:25:31 +00:00
|
|
|
sha256 = "sha256-O5nu58QFlOPTaN4qNi50Wp9acxM6dWNy63BD+AnVl5w=";
|
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
|
|
|
|
# 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-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
# backport a fix to actually install the new module
|
|
|
|
# FIXME: remove after 0.3.66
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/fba7083f8ceb210c7c20aceafeb5c9a8767cf705.patch";
|
|
|
|
hash = "sha256-aZQ4OzK0B5YPq+jQNygxPE0coG2qB0ukbYzyI8E24XM=";
|
|
|
|
})
|
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
|
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
|
2021-06-28 23:13:55 +00:00
|
|
|
webrtc-audio-processing
|
2022-06-26 10:26:21 +00:00
|
|
|
] ++ (if enableSystemd then [ systemd ] else [ eudev ])
|
|
|
|
++ 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
|
2022-10-30 15:09:59 +00:00
|
|
|
++ lib.optionals bluezSupport [ bluez libfreeaptx ldacbt liblc3 sbc fdk_aac libopus ]
|
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
|
2022-03-05 16:20:37 +00:00
|
|
|
++ lib.optionals x11Support [ libcanberra xorg.libX11 xorg.libXfixes ];
|
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}"
|
|
|
|
"-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}"
|
|
|
|
"-Dbluez5-backend-ofono=${mesonEnableFeature ofonoSupport}"
|
|
|
|
"-Dbluez5-backend-hsphfpd=${mesonEnableFeature hsphfpdSupport}"
|
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}"
|
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}"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-Dsdl2=disabled" # required only to build examples, causes dependency loop
|
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 = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
mkdir $out/nix-support
|
2021-12-30 13:39:12 +00:00
|
|
|
${if (stdenv.hostPlatform == stdenv.buildPlatform) then ''
|
|
|
|
pushd $lib/share/pipewire
|
|
|
|
for f in *.conf; do
|
|
|
|
echo "Generating JSON from $f"
|
|
|
|
|
|
|
|
$out/bin/spa-json-dump "$f" > "$out/nix-support/$f.json"
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
'' else ''
|
|
|
|
cp ${buildPackages.pipewire}/nix-support/*.json "$out/nix-support"
|
|
|
|
''}
|
2021-03-09 03:18:52 +00:00
|
|
|
|
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"
|
|
|
|
''}
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
moveToOutput "bin/pipewire-pulse" "$pulse"
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
moveToOutput "bin/pw-jack" "$jack"
|
2021-02-17 17:02:09 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
passthru = {
|
2021-12-06 16:07:01 +00:00
|
|
|
updateScript = ./update-pipewire.sh;
|
2021-05-03 20:48:10 +00:00
|
|
|
tests = {
|
|
|
|
installedTests = nixosTests.installed-tests.pipewire;
|
|
|
|
|
|
|
|
# This ensures that all the paths used by the NixOS module are found.
|
2021-12-06 16:07:01 +00:00
|
|
|
test-paths = callPackage ./test-paths.nix { package = self; } {
|
2021-05-03 20:48:10 +00:00
|
|
|
paths-out = [
|
|
|
|
"share/alsa/alsa.conf.d/50-pipewire.conf"
|
2021-12-06 16:07:01 +00:00
|
|
|
"nix-support/client-rt.conf.json"
|
|
|
|
"nix-support/client.conf.json"
|
|
|
|
"nix-support/jack.conf.json"
|
2022-03-05 16:20:37 +00:00
|
|
|
"nix-support/minimal.conf.json"
|
2021-12-06 16:07:01 +00:00
|
|
|
"nix-support/pipewire.conf.json"
|
|
|
|
"nix-support/pipewire-pulse.conf.json"
|
2021-05-03 20:48:10 +00:00
|
|
|
];
|
|
|
|
paths-lib = [
|
|
|
|
"lib/alsa-lib/libasound_module_pcm_pipewire.so"
|
|
|
|
"share/alsa-card-profile/mixer"
|
|
|
|
];
|
|
|
|
};
|
2021-02-17 17:02:09 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Server and user space API to deal with multimedia pipelines";
|
|
|
|
homepage = "https://pipewire.org/";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.linux;
|
2023-02-02 18:25:31 +00:00
|
|
|
maintainers = with maintainers; [ jtojnar 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
|