2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
2020-10-27 00:29:36 +00:00
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitLab
|
2020-10-27 00:29:36 +00:00
|
|
|
, removeReferencesTo
|
2021-06-28 23:13:55 +00:00
|
|
|
, python3
|
2020-04-24 23:36:52 +00:00
|
|
|
, meson
|
|
|
|
, ninja
|
2020-10-27 00:29:36 +00:00
|
|
|
, systemd
|
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
|
|
|
|
, valgrind
|
|
|
|
, 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
|
|
|
|
, libva
|
|
|
|
, libsndfile
|
2021-03-09 03:18:52 +00:00
|
|
|
, SDL2
|
2020-04-24 23:36:52 +00:00
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
2021-06-28 23:13:55 +00:00
|
|
|
, webrtc-audio-processing
|
2021-02-17 17:02:09 +00:00
|
|
|
, ncurses
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeFontsConf
|
2020-10-27 00:29:36 +00:00
|
|
|
, callPackage
|
|
|
|
, nixosTests
|
2021-02-17 17:02:09 +00:00
|
|
|
, withMediaSession ? true
|
2021-09-18 10:52:07 +00:00
|
|
|
, gstreamerSupport ? true
|
|
|
|
, gst_all_1 ? null
|
|
|
|
, ffmpegSupport ? true
|
|
|
|
, ffmpeg ? null
|
|
|
|
, bluezSupport ? true
|
|
|
|
, bluez ? null
|
|
|
|
, sbc ? null
|
|
|
|
, libfreeaptx ? null
|
|
|
|
, ldacbt ? null
|
|
|
|
, fdk_aac ? null
|
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
|
|
|
|
, libpulseaudio ? null
|
|
|
|
, zeroconfSupport ? true
|
|
|
|
, avahi ? null
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
fontsConf = makeFontsConf {
|
2021-09-18 10:52:07 +00:00
|
|
|
fontDirectories = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-10-27 00:29:36 +00:00
|
|
|
|
2021-03-23 19:22:30 +00:00
|
|
|
mesonEnable = b: if b then "enabled" else "disabled";
|
2021-07-14 22:03:04 +00:00
|
|
|
mesonList = l: "[" + lib.concatStringsSep "," l + "]";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
self = stdenv.mkDerivation rec {
|
|
|
|
pname = "pipewire";
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "0.3.36";
|
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
|
|
|
"mediaSession"
|
|
|
|
"installedTests"
|
|
|
|
];
|
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "gitlab.freedesktop.org";
|
|
|
|
owner = "pipewire";
|
|
|
|
repo = "pipewire";
|
|
|
|
rev = version;
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "sha256-kwoffB0Hi84T4Q0NaxLxsCyPV4R0LayX9kHmXU/vRPA=";
|
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
|
|
|
|
# Change the path of the pipewire-media-session binary in the service definition.
|
|
|
|
./0055-pipewire-media-session-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-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
|
|
|
|
ncurses
|
|
|
|
udev
|
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
2021-06-28 23:13:55 +00:00
|
|
|
webrtc-audio-processing
|
2021-02-17 17:02:09 +00:00
|
|
|
valgrind
|
2021-03-09 03:18:52 +00:00
|
|
|
SDL2
|
2021-02-17 17:02:09 +00:00
|
|
|
systemd
|
|
|
|
] ++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ]
|
|
|
|
++ lib.optional ffmpegSupport ffmpeg
|
2021-08-08 23:34:03 +00:00
|
|
|
++ lib.optionals bluezSupport [ bluez libfreeaptx ldacbt sbc fdk_aac ]
|
2021-06-28 23:13:55 +00:00
|
|
|
++ lib.optional pulseTunnelSupport libpulseaudio
|
|
|
|
++ lib.optional zeroconfSupport avahi;
|
2021-02-17 17:02:09 +00:00
|
|
|
|
|
|
|
mesonFlags = [
|
2021-03-23 19:22:30 +00:00
|
|
|
"-Ddocs=enabled"
|
|
|
|
"-Dexamples=${mesonEnable withMediaSession}" # only needed for `pipewire-media-session`
|
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"}"
|
2021-03-09 03:18:52 +00:00
|
|
|
"-Dmedia-session-prefix=${placeholder "mediaSession"}"
|
2021-02-17 17:02:09 +00:00
|
|
|
"-Dlibjack-path=${placeholder "jack"}/lib"
|
2021-03-23 19:22:30 +00:00
|
|
|
"-Dlibcamera=disabled"
|
2021-07-14 22:03:04 +00:00
|
|
|
"-Droc=disabled"
|
2021-06-28 23:13:55 +00:00
|
|
|
"-Dlibpulse=${mesonEnable pulseTunnelSupport}"
|
|
|
|
"-Davahi=${mesonEnable zeroconfSupport}"
|
2021-03-23 19:22:30 +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-28 23:13:55 +00:00
|
|
|
"-Dsysconfdir=/etc"
|
|
|
|
"-Dpipewire_confdata_dir=${placeholder "lib"}/share/pipewire"
|
2021-07-14 22:03:04 +00:00
|
|
|
"-Dsession-managers=${mesonList (lib.optional withMediaSession "media-session")}"
|
2021-02-17 17:02:09 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
postUnpack = ''
|
|
|
|
patchShebangs source/doc/strip-static.sh
|
|
|
|
patchShebangs source/spa/tests/gen-cpp-test.py
|
|
|
|
'';
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
postInstall = ''
|
2021-06-28 23:13:55 +00:00
|
|
|
pushd $lib/share
|
2021-03-09 03:18:52 +00:00
|
|
|
mkdir -p $out/nix-support/etc/pipewire
|
2021-06-28 23:13:55 +00:00
|
|
|
for f in pipewire/*.conf; do
|
|
|
|
echo "Generating JSON from $f"
|
|
|
|
$out/bin/spa-json-dump "$f" > "$out/nix-support/etc/$f.json"
|
|
|
|
done
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
mkdir -p $mediaSession/nix-support/etc/pipewire/media-session.d
|
2021-06-28 23:13:55 +00:00
|
|
|
for f in pipewire/media-session.d/*.conf; do
|
|
|
|
echo "Generating JSON from $f"
|
|
|
|
$out/bin/spa-json-dump "$f" > "$mediaSession/nix-support/etc/$f.json"
|
|
|
|
done
|
2021-03-09 03:18:52 +00:00
|
|
|
popd
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
moveToOutput "share/pipewire/media-session.d/*.conf" "$mediaSession"
|
2021-03-09 03:18:52 +00:00
|
|
|
moveToOutput "share/systemd/user/pipewire-media-session.*" "$mediaSession"
|
|
|
|
moveToOutput "lib/systemd/user/pipewire-media-session.*" "$mediaSession"
|
|
|
|
moveToOutput "bin/pipewire-media-session" "$mediaSession"
|
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
|
|
|
|
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
|
|
|
|
moveToOutput "bin/pipewire-pulse" "$pulse"
|
|
|
|
'';
|
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
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 {
|
|
|
|
paths-out = [
|
|
|
|
"share/alsa/alsa.conf.d/50-pipewire.conf"
|
2021-06-28 23:13:55 +00:00
|
|
|
"nix-support/etc/pipewire/client-rt.conf.json"
|
2021-05-03 20:48:10 +00:00
|
|
|
"nix-support/etc/pipewire/client.conf.json"
|
|
|
|
"nix-support/etc/pipewire/jack.conf.json"
|
|
|
|
"nix-support/etc/pipewire/pipewire.conf.json"
|
|
|
|
"nix-support/etc/pipewire/pipewire-pulse.conf.json"
|
|
|
|
];
|
|
|
|
paths-out-media-session = [
|
|
|
|
"nix-support/etc/pipewire/media-session.d/alsa-monitor.conf.json"
|
|
|
|
"nix-support/etc/pipewire/media-session.d/bluez-monitor.conf.json"
|
2021-07-14 22:03:04 +00:00
|
|
|
"nix-support/etc/pipewire/media-session.d/bluez-hardware.conf.json"
|
2021-05-03 20:48:10 +00:00
|
|
|
"nix-support/etc/pipewire/media-session.d/media-session.conf.json"
|
|
|
|
"nix-support/etc/pipewire/media-session.d/v4l2-monitor.conf.json"
|
|
|
|
];
|
|
|
|
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;
|
2021-08-08 23:34:03 +00:00
|
|
|
maintainers = with maintainers; [ jtojnar kranzes ];
|
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
|