2020-02-29 15:59:51 +00:00
|
|
|
{ stdenv
|
2020-10-23 18:34:45 +01:00
|
|
|
, lib
|
2020-02-29 16:14:42 +00:00
|
|
|
, fetchFromGitLab
|
2020-10-23 18:42:50 +01:00
|
|
|
, fetchpatch
|
|
|
|
, removeReferencesTo
|
2020-02-29 15:59:51 +00:00
|
|
|
, meson
|
|
|
|
, ninja
|
2020-10-23 18:34:45 +01:00
|
|
|
, systemd
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2020-02-29 15:59:51 +00:00
|
|
|
, doxygen
|
|
|
|
, graphviz
|
|
|
|
, valgrind
|
|
|
|
, glib
|
|
|
|
, dbus
|
|
|
|
, alsaLib
|
|
|
|
, libjack2
|
|
|
|
, udev
|
|
|
|
, libva
|
2020-02-29 16:14:42 +00:00
|
|
|
, libsndfile
|
2021-02-25 14:22:40 +00:00
|
|
|
, SDL2
|
2020-02-29 16:14:42 +00:00
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
2021-01-23 17:54:09 +00:00
|
|
|
, ncurses
|
2020-02-29 15:59:51 +00:00
|
|
|
, makeFontsConf
|
2020-08-05 19:48:37 +01:00
|
|
|
, callPackage
|
|
|
|
, nixosTests
|
2021-01-23 17:54:09 +00:00
|
|
|
, withMediaSession ? true
|
2020-10-23 18:34:45 +01:00
|
|
|
, gstreamerSupport ? true, gst_all_1 ? null
|
|
|
|
, ffmpegSupport ? true, ffmpeg ? null
|
2021-01-23 17:54:09 +00:00
|
|
|
, bluezSupport ? true, bluez ? null, sbc ? null, libopenaptx ? null, ldacbt ? null, fdk_aac ? null
|
2020-08-05 05:13:04 +01:00
|
|
|
, nativeHspSupport ? true
|
2021-01-23 17:54:09 +00:00
|
|
|
, nativeHfpSupport ? true
|
2020-10-23 18:34:45 +01:00
|
|
|
, ofonoSupport ? true
|
2020-11-29 13:47:20 +00:00
|
|
|
, hsphfpdSupport ? true
|
2017-11-14 03:41:25 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-02-27 16:15:13 +00:00
|
|
|
fontsConf = makeFontsConf {
|
2020-02-29 15:59:51 +00:00
|
|
|
fontDirectories = [];
|
2018-02-27 16:15:13 +00:00
|
|
|
};
|
2020-10-23 18:34:45 +01:00
|
|
|
|
|
|
|
mesonBool = b: if b then "true" else "false";
|
2017-11-14 03:41:25 +00:00
|
|
|
|
2021-01-23 17:54:09 +00:00
|
|
|
self = stdenv.mkDerivation rec {
|
|
|
|
pname = "pipewire";
|
2021-03-04 22:41:02 +00:00
|
|
|
version = "0.3.23";
|
2020-08-31 19:37:36 +01:00
|
|
|
|
2021-01-23 17:54:09 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"lib"
|
|
|
|
"pulse"
|
|
|
|
"jack"
|
|
|
|
"dev"
|
|
|
|
"doc"
|
2021-02-03 20:57:38 +00:00
|
|
|
"mediaSession"
|
2021-01-23 17:54:09 +00:00
|
|
|
"installedTests"
|
|
|
|
];
|
2020-08-05 19:48:37 +01:00
|
|
|
|
2021-01-23 17:54:09 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "gitlab.freedesktop.org";
|
|
|
|
owner = "pipewire";
|
|
|
|
repo = "pipewire";
|
|
|
|
rev = version;
|
2021-03-04 22:41:02 +00:00
|
|
|
hash = "sha256:1HMUrE1NBmrdBRMKX3LRlXaCEH3wqP2jGtW8Rp9oyQA=";
|
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
|
|
|
|
# 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-01-23 17:54:09 +00:00
|
|
|
# Add flag to specify configuration directory (different from the installation directory).
|
2021-03-04 22:41:02 +00:00
|
|
|
./0080-pipewire-config-dir.patch
|
2021-01-23 17:54:09 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
doxygen
|
|
|
|
graphviz
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
alsaLib
|
|
|
|
dbus
|
|
|
|
glib
|
|
|
|
libjack2
|
|
|
|
libsndfile
|
|
|
|
ncurses
|
|
|
|
udev
|
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
|
|
|
valgrind
|
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 ]
|
|
|
|
++ lib.optional ffmpegSupport ffmpeg
|
|
|
|
++ lib.optionals bluezSupport [ bluez libopenaptx ldacbt sbc fdk_aac ];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Ddocs=true"
|
|
|
|
"-Dman=false" # we don't have xmltoman
|
|
|
|
"-Dexamples=${mesonBool withMediaSession}" # only needed for `pipewire-media-session`
|
|
|
|
"-Dudevrulesdir=lib/udev/rules.d"
|
|
|
|
"-Dinstalled_tests=true"
|
|
|
|
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
|
|
|
|
"-Dpipewire_pulse_prefix=${placeholder "pulse"}"
|
2021-03-04 22:41:02 +00:00
|
|
|
"-Dmedia-session-prefix=${placeholder "mediaSession"}"
|
2021-01-23 17:54:09 +00:00
|
|
|
"-Dlibjack-path=${placeholder "jack"}/lib"
|
|
|
|
"-Dgstreamer=${mesonBool gstreamerSupport}"
|
|
|
|
"-Dffmpeg=${mesonBool ffmpegSupport}"
|
|
|
|
"-Dbluez5=${mesonBool bluezSupport}"
|
|
|
|
"-Dbluez5-backend-hsp-native=${mesonBool nativeHspSupport}"
|
|
|
|
"-Dbluez5-backend-hfp-native=${mesonBool nativeHfpSupport}"
|
|
|
|
"-Dbluez5-backend-ofono=${mesonBool ofonoSupport}"
|
|
|
|
"-Dbluez5-backend-hsphfpd=${mesonBool hsphfpdSupport}"
|
|
|
|
"-Dpipewire_config_dir=/etc/pipewire"
|
|
|
|
];
|
|
|
|
|
|
|
|
FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
postInstall = ''
|
2021-03-04 22:41:02 +00:00
|
|
|
pushd .
|
|
|
|
cd $out
|
|
|
|
mkdir -p $out/nix-support/etc/pipewire
|
|
|
|
for f in etc/pipewire/*.conf; do bin/spa-json-dump "$f" > "$out/nix-support/$f.json"; done
|
|
|
|
|
|
|
|
mkdir -p $mediaSession/nix-support/etc/pipewire/media-session.d
|
|
|
|
for f in etc/pipewire/media-session.d/*.conf; do bin/spa-json-dump "$f" > "$mediaSession/nix-support/$f.json"; done
|
|
|
|
popd
|
|
|
|
|
|
|
|
moveToOutput "etc/pipewire/media-session.d/*.conf" "$mediaSession"
|
|
|
|
moveToOutput "share/systemd/user/pipewire-media-session.*" "$mediaSession"
|
|
|
|
moveToOutput "lib/systemd/user/pipewire-media-session.*" "$mediaSession"
|
|
|
|
moveToOutput "bin/pipewire-media-session" "$mediaSession"
|
2021-02-25 14:22:40 +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-02-10 17:32:58 +00:00
|
|
|
passthru.tests = {
|
2021-02-03 20:57:38 +00:00
|
|
|
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-02-25 14:22:40 +00:00
|
|
|
"nix-support/etc/pipewire/client.conf.json"
|
|
|
|
"nix-support/etc/pipewire/client-rt.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"
|
|
|
|
"nix-support/etc/pipewire/media-session.d/media-session.conf.json"
|
|
|
|
"nix-support/etc/pipewire/media-session.d/v4l2-monitor.conf.json"
|
2021-02-03 20:57:38 +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
|
|
|
};
|
2020-08-05 19:48:37 +01: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 ];
|
|
|
|
};
|
2017-11-14 03:41:25 +00:00
|
|
|
};
|
2021-01-23 17:54:09 +00:00
|
|
|
|
|
|
|
in self
|