nixpkgs/pkgs/development/libraries/pipewire/default.nix

226 lines
5.9 KiB
Nix
Raw Normal View History

2020-02-29 15:59:51 +00:00
{ stdenv
2020-10-23 17:34:45 +00:00
, lib
2021-12-19 11:07:17 +00:00
, buildPackages
, fetchFromGitLab
, removeReferencesTo
2021-06-02 00:16:43 +00:00
, python3
2020-02-29 15:59:51 +00:00
, meson
, ninja
2020-10-23 17:34:45 +00:00
, systemd
, pkg-config
2021-09-12 15:24:25 +00:00
, docutils
2020-02-29 15:59:51 +00:00
, doxygen
, graphviz
, glib
, dbus
, alsa-lib
2020-02-29 15:59:51 +00:00
, libjack2
2021-06-28 18:06:44 +00:00
, libusb1
2020-02-29 15:59:51 +00:00
, udev
, libva
, libsndfile
2021-02-25 14:22:40 +00:00
, SDL2
, vulkan-headers
, vulkan-loader
2021-06-02 00:16:43 +00:00
, webrtc-audio-processing
2021-01-23 17:54:09 +00:00
, ncurses
2021-09-30 16:38:31 +00:00
, readline81 # meson can't find <7 as those versions don't have a .pc file
2020-02-29 15:59:51 +00:00
, makeFontsConf
, callPackage
, nixosTests
, withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind
, valgrind
2021-01-23 17:54:09 +00:00
, withMediaSession ? true
2021-09-25 15:08:28 +00:00
, libcameraSupport ? true
, libcamera
, libdrm
2021-08-26 17:29:13 +00:00
, gstreamerSupport ? true
, gst_all_1
2021-08-26 17:29:13 +00:00
, ffmpegSupport ? true
, ffmpeg
2021-08-26 17:29:13 +00:00
, bluezSupport ? true
, bluez
, sbc
, libfreeaptx
, ldacbt
, fdk_aac
, nativeHspSupport ? true
2021-01-23 17:54:09 +00:00
, nativeHfpSupport ? true
2020-10-23 17:34:45 +00:00
, ofonoSupport ? true
, hsphfpdSupport ? true
2021-08-26 17:29:13 +00:00
, pulseTunnelSupport ? true
, libpulseaudio
2021-08-26 17:29:13 +00:00
, zeroconfSupport ? true
, avahi
2017-11-14 03:41:25 +00:00
}:
let
2018-02-27 16:15:13 +00:00
fontsConf = makeFontsConf {
2021-08-26 17:29:13 +00:00
fontDirectories = [ ];
2018-02-27 16:15:13 +00:00
};
2020-10-23 17:34:45 +00:00
2021-03-14 23:38:20 +00:00
mesonEnable = b: if b then "enabled" else "disabled";
2021-06-28 18:06:44 +00:00
mesonList = l: "[" + lib.concatStringsSep "," l + "]";
2017-11-14 03:41:25 +00:00
2021-01-23 17:54:09 +00:00
self = stdenv.mkDerivation rec {
pname = "pipewire";
2021-11-11 17:45:07 +00:00
version = "0.3.40";
2021-01-23 17:54:09 +00:00
outputs = [
"out"
"lib"
"pulse"
"jack"
"dev"
"doc"
2021-09-12 15:24:25 +00:00
"man"
2021-01-23 17:54:09 +00:00
"installedTests"
];
2021-01-23 17:54:09 +00:00
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "pipewire";
rev = version;
2021-11-11 17:45:07 +00:00
sha256 = "sha256-eY6uQa4+sC6yUWhF4IpAgRoppwhHO4s5fIMXOkS0z7A=";
2021-01-23 17:54:09 +00:00
};
patches = [
# Break up a dependency cycle between outputs.
2021-03-04 22:41:02 +00:00
./0040-alsa-profiles-use-libdir.patch
2021-01-23 17:54:09 +00:00
# Change the path of the pipewire-pulse binary in the service definition.
2021-03-04 22:41:02 +00:00
./0050-pipewire-pulse-path.patch
# Move installed tests into their own output.
./0070-installed-tests-path.patch
2021-06-02 00:16:43 +00:00
# Add option for changing the config install directory
2021-03-04 22:41:02 +00:00
./0080-pipewire-config-dir.patch
2021-06-02 00:16:43 +00:00
# Remove output paths from the comments in the config templates to break dependency cycles
./0090-pipewire-config-template-paths.patch
2021-09-25 14:49:23 +00:00
# Place SPA data files in lib output to avoid dependency cycles
./0095-spa-data-dir.patch
2021-01-23 17:54:09 +00:00
];
nativeBuildInputs = [
2021-09-12 15:24:25 +00:00
docutils
2021-01-23 17:54:09 +00:00
doxygen
graphviz
meson
ninja
pkg-config
2021-06-02 00:16:43 +00:00
python3
2021-01-23 17:54:09 +00:00
];
buildInputs = [
alsa-lib
2021-01-23 17:54:09 +00:00
dbus
glib
libjack2
2021-06-28 18:06:44 +00:00
libusb1
2021-01-23 17:54:09 +00:00
libsndfile
ncurses
2021-09-30 16:38:31 +00:00
readline81
2021-01-23 17:54:09 +00:00
udev
vulkan-headers
vulkan-loader
2021-06-02 00:16:43 +00:00
webrtc-audio-processing
2021-02-25 14:22:40 +00:00
SDL2
2021-01-23 17:54:09 +00:00
systemd
] ++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ]
2021-09-25 15:08:28 +00:00
++ lib.optionals libcameraSupport [ libcamera libdrm ]
2021-01-23 17:54:09 +00:00
++ lib.optional ffmpegSupport ffmpeg
2021-08-06 10:35:12 +00:00
++ lib.optionals bluezSupport [ bluez libfreeaptx ldacbt sbc fdk_aac ]
2021-06-02 00:16:43 +00:00
++ lib.optional pulseTunnelSupport libpulseaudio
++ lib.optional zeroconfSupport avahi;
2021-01-23 17:54:09 +00:00
# Valgrind binary is required for running one optional test.
checkInputs = lib.optional withValgrind valgrind;
2021-01-23 17:54:09 +00:00
mesonFlags = [
2021-03-14 23:38:20 +00:00
"-Ddocs=enabled"
2021-01-23 17:54:09 +00:00
"-Dudevrulesdir=lib/udev/rules.d"
2021-03-14 23:38:20 +00:00
"-Dinstalled_tests=enabled"
2021-01-23 17:54:09 +00:00
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
"-Dpipewire_pulse_prefix=${placeholder "pulse"}"
"-Dlibjack-path=${placeholder "jack"}/lib"
2021-09-25 15:08:28 +00:00
"-Dlibcamera=${mesonEnable libcameraSupport}"
2021-06-28 18:06:44 +00:00
"-Droc=disabled"
2021-06-02 00:16:43 +00:00
"-Dlibpulse=${mesonEnable pulseTunnelSupport}"
"-Davahi=${mesonEnable zeroconfSupport}"
2021-03-14 23:38:20 +00:00
"-Dgstreamer=${mesonEnable gstreamerSupport}"
"-Dffmpeg=${mesonEnable ffmpegSupport}"
"-Dbluez5=${mesonEnable bluezSupport}"
"-Dbluez5-backend-hsp-native=${mesonEnable nativeHspSupport}"
"-Dbluez5-backend-hfp-native=${mesonEnable nativeHfpSupport}"
"-Dbluez5-backend-ofono=${mesonEnable ofonoSupport}"
"-Dbluez5-backend-hsphfpd=${mesonEnable hsphfpdSupport}"
2021-06-02 00:16:43 +00:00
"-Dsysconfdir=/etc"
"-Dpipewire_confdata_dir=${placeholder "lib"}/share/pipewire"
"-Dsession-managers="
"-Dvulkan=enabled"
2021-01-23 17:54:09 +00:00
];
FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
doCheck = true;
2021-06-02 00:16:43 +00:00
postUnpack = ''
patchShebangs source/doc/strip-static.sh
patchShebangs source/doc/input-filter.sh
patchShebangs source/doc/input-filter-h.sh
2021-06-02 00:16:43 +00:00
patchShebangs source/spa/tests/gen-cpp-test.py
'';
2021-01-23 17:54:09 +00:00
postInstall = ''
mkdir $out/nix-support
2021-12-19 11:07:17 +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-04 22:41:02 +00:00
2021-01-23 17:54:09 +00:00
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
moveToOutput "bin/pipewire-pulse" "$pulse"
'';
2021-04-27 10:52:41 +00:00
passthru = {
2021-11-11 17:45:07 +00:00
updateScript = ./update-pipewire.sh;
2021-04-27 10:52:41 +00:00
tests = {
installedTests = nixosTests.installed-tests.pipewire;
# This ensures that all the paths used by the NixOS module are found.
test-paths = callPackage ./test-paths.nix { package = self; } {
2021-04-27 10:52:41 +00:00
paths-out = [
"share/alsa/alsa.conf.d/50-pipewire.conf"
"nix-support/client-rt.conf.json"
"nix-support/client.conf.json"
"nix-support/jack.conf.json"
"nix-support/pipewire.conf.json"
"nix-support/pipewire-pulse.conf.json"
2021-04-27 10:52:41 +00:00
];
paths-lib = [
"lib/alsa-lib/libasound_module_pcm_pipewire.so"
"share/alsa-card-profile/mixer"
];
};
2021-01-23 17:54:09 +00:00
};
};
2021-01-23 17:54: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;
maintainers = with maintainers; [ jtojnar kranzes ];
2021-01-23 17:54:09 +00:00
};
2017-11-14 03:41:25 +00:00
};
2021-01-23 17:54:09 +00:00
2021-08-26 17:29:13 +00:00
in
self