nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 testers,
5 buildPackages,
6 fetchFromGitLab,
7 python3,
8 meson,
9 ninja,
10 freebsd,
11 elogind,
12 libinotify-kqueue,
13 epoll-shim,
14 systemd,
15 enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, # enableSystemd=false maintained by maintainers.qyliss.
16 pkg-config,
17 docutils,
18 doxygen,
19 graphviz,
20 glib,
21 dbus,
22 alsa-lib,
23 libjack2,
24 libusb1,
25 udev,
26 libsndfile,
27 vulkanSupport ? true,
28 vulkan-headers,
29 vulkan-loader,
30 webrtc-audio-processing,
31 ncurses,
32 readline, # meson can't find <7 as those versions don't have a .pc file
33 lilv,
34 makeFontsConf,
35 nixosTests,
36 valgrind,
37 libcamera,
38 libdrm,
39 gst_all_1,
40 ffmpeg,
41 fftwFloat,
42 bluezSupport ? stdenv.hostPlatform.isLinux,
43 bluez,
44 sbc,
45 libfreeaptx,
46 liblc3,
47 fdk_aac,
48 libopus,
49 ldacbt,
50 modemmanager,
51 libpulseaudio,
52 zeroconfSupport ? true,
53 avahi,
54 raopSupport ? true,
55 openssl,
56 rocSupport ? true,
57 roc-toolkit,
58 x11Support ? true,
59 libcanberra,
60 libxfixes,
61 libx11,
62 libxcb,
63 libmysofa,
64 ffadoSupport ?
65 x11Support
66 && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform
67 && lib.meta.availableOn stdenv.hostPlatform ffado,
68 ffado,
69 libselinux,
70 libebur128,
71 bashNonInteractive,
72}:
73
74let
75 modemmanagerSupport = lib.meta.availableOn stdenv.hostPlatform modemmanager;
76 libcameraSupport = lib.meta.availableOn stdenv.hostPlatform libcamera;
77 ldacbtSupport = lib.meta.availableOn stdenv.hostPlatform ldacbt;
78 webrtcAudioProcessingSupport = lib.meta.availableOn stdenv.hostPlatform webrtc-audio-processing;
79in
80
81stdenv.mkDerivation (finalAttrs: {
82 pname = "pipewire";
83 version = "1.4.10";
84
85 outputs = [
86 "out"
87 "jack"
88 "dev"
89 "doc"
90 "man"
91 "installedTests"
92 ];
93
94 src = fetchFromGitLab {
95 domain = "gitlab.freedesktop.org";
96 owner = "pipewire";
97 repo = "pipewire";
98 rev = finalAttrs.version;
99 sha256 = "sha256-/Av2iXWInsY6S+PdbfCm1AFtHEFt4LXhgRJ6r9lqOpM=";
100 };
101
102 patches = [
103 # Load libjack from a known location
104 ./0060-libjack-path.patch
105 # Move installed tests into their own output.
106 ./0070-installed-tests-path.patch
107 ];
108
109 strictDeps = true;
110 depsBuildBuild = [ buildPackages.stdenv.cc ];
111 nativeBuildInputs = [
112 docutils
113 doxygen
114 graphviz
115 meson
116 ninja
117 pkg-config
118 python3
119 glib
120 ];
121
122 buildInputs = [
123 dbus
124 ffmpeg
125 fftwFloat
126 glib
127 gst_all_1.gst-plugins-base
128 gst_all_1.gstreamer
129 libebur128
130 libjack2
131 libmysofa
132 libopus
133 libpulseaudio
134 libusb1
135 libsndfile
136 lilv
137 ncurses
138 readline
139 bashNonInteractive
140 ]
141 ++ (
142 if enableSystemd then
143 [ systemd ]
144 else if stdenv.hostPlatform.isLinux then
145 [
146 elogind
147 udev
148 ]
149 else
150 [ ]
151 )
152 ++ lib.optionals stdenv.hostPlatform.isFreeBSD [
153 libinotify-kqueue
154 epoll-shim
155 freebsd.libstdthreads
156 ]
157 ++ lib.optional webrtcAudioProcessingSupport webrtc-audio-processing
158 ++ lib.optional stdenv.hostPlatform.isLinux alsa-lib
159 ++ lib.optional ldacbtSupport ldacbt
160 ++ lib.optional libcameraSupport libcamera
161 ++ lib.optional zeroconfSupport avahi
162 ++ lib.optional raopSupport openssl
163 ++ lib.optional rocSupport roc-toolkit
164 ++ lib.optionals vulkanSupport [
165 libdrm
166 vulkan-headers
167 vulkan-loader
168 ]
169 ++ lib.optionals x11Support [
170 libcanberra
171 libx11
172 libxcb
173 libxfixes
174 ]
175 ++ lib.optionals bluezSupport [
176 bluez
177 libfreeaptx
178 liblc3
179 sbc
180 fdk_aac
181 ]
182 ++ lib.optional ffadoSupport ffado
183 ++ lib.optional stdenv.hostPlatform.isLinux libselinux
184 ++ lib.optional modemmanagerSupport modemmanager;
185
186 # Valgrind binary is required for running one optional test.
187 nativeCheckInputs = lib.optional (lib.meta.availableOn stdenv.hostPlatform valgrind) valgrind;
188
189 mesonFlags = [
190 (lib.mesonEnable "pipewire-alsa" stdenv.hostPlatform.isLinux)
191 (lib.mesonEnable "alsa" stdenv.hostPlatform.isLinux)
192 (lib.mesonEnable "docs" true)
193 (lib.mesonOption "udevrulesdir" "lib/udev/rules.d")
194 (lib.mesonEnable "installed_tests" true)
195 (lib.mesonOption "installed_test_prefix" (placeholder "installedTests"))
196 (lib.mesonOption "libjack-path" "${placeholder "jack"}/lib")
197 (lib.mesonEnable "echo-cancel-webrtc" webrtcAudioProcessingSupport)
198 (lib.mesonEnable "libcamera" (lib.meta.availableOn stdenv.hostPlatform libcamera))
199 (lib.mesonEnable "libffado" ffadoSupport)
200 (lib.mesonEnable "roc" rocSupport)
201 (lib.mesonEnable "libpulse" true)
202 (lib.mesonEnable "avahi" zeroconfSupport)
203 (lib.mesonEnable "gstreamer" true)
204 (lib.mesonEnable "gstreamer-device-provider" true)
205 (lib.mesonOption "logind-provider" (if enableSystemd then "libsystemd" else "libelogind"))
206 (lib.mesonEnable "logind" stdenv.hostPlatform.isLinux)
207 (lib.mesonEnable "selinux" stdenv.hostPlatform.isLinux)
208 (lib.mesonEnable "avb" stdenv.hostPlatform.isLinux)
209 (lib.mesonEnable "v4l2" stdenv.hostPlatform.isLinux)
210 (lib.mesonEnable "pipewire-v4l2" stdenv.hostPlatform.isLinux)
211 (lib.mesonEnable "systemd" enableSystemd)
212 (lib.mesonEnable "systemd-system-service" enableSystemd)
213 (lib.mesonEnable "udev" (!enableSystemd && stdenv.hostPlatform.isLinux))
214 (lib.mesonEnable "ffmpeg" true)
215 (lib.mesonEnable "pw-cat-ffmpeg" true)
216 (lib.mesonEnable "bluez5" bluezSupport)
217 (lib.mesonEnable "bluez5-backend-hsp-native" bluezSupport)
218 (lib.mesonEnable "bluez5-backend-hfp-native" bluezSupport)
219 (lib.mesonEnable "bluez5-backend-native-mm" bluezSupport)
220 (lib.mesonEnable "bluez5-backend-ofono" bluezSupport)
221 (lib.mesonEnable "bluez5-backend-hsphfpd" bluezSupport)
222 # source code is not easily obtainable
223 (lib.mesonEnable "bluez5-codec-lc3plus" false)
224 (lib.mesonEnable "bluez5-codec-lc3" bluezSupport)
225 (lib.mesonEnable "bluez5-codec-ldac" (bluezSupport && ldacbtSupport))
226 (lib.mesonEnable "opus" true)
227 (lib.mesonOption "sysconfdir" "/etc")
228 (lib.mesonEnable "raop" raopSupport)
229 (lib.mesonOption "session-managers" "")
230 (lib.mesonEnable "vulkan" vulkanSupport)
231 (lib.mesonEnable "x11" x11Support)
232 (lib.mesonEnable "x11-xfixes" x11Support)
233 (lib.mesonEnable "libcanberra" x11Support)
234 (lib.mesonEnable "libmysofa" true)
235 (lib.mesonEnable "sdl2" false) # required only to build examples, causes dependency loop
236 (lib.mesonBool "rlimits-install" false) # installs to /etc, we won't use this anyway
237 (lib.mesonEnable "compress-offload" true)
238 (lib.mesonEnable "man" true)
239 (lib.mesonEnable "snap" false) # we don't currently have a working snapd
240 ];
241
242 # Fontconfig error: Cannot load default config file
243 FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
244
245 doCheck = true;
246 doInstallCheck = true;
247
248 postPatch = ''
249 patchShebangs doc/*.py
250 patchShebangs doc/input-filter-h.sh
251
252 # Remove installed-test that runs forever
253 sed -i -e "/test-pipewire-alsa-stress/d" pipewire-alsa/tests/meson.build
254 '';
255
256 postInstall = ''
257 moveToOutput "bin/pw-jack" "$jack"
258 '';
259
260 passthru.tests = {
261 installed-tests = nixosTests.installed-tests.pipewire;
262 pkg-config = testers.hasPkgConfigModules {
263 package = finalAttrs.finalPackage;
264 };
265 };
266
267 meta = {
268 description = "Server and user space API to deal with multimedia pipelines";
269 changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${finalAttrs.version}";
270 homepage = "https://pipewire.org/";
271 license = lib.licenses.mit;
272 platforms = lib.platforms.linux ++ lib.platforms.freebsd;
273 maintainers = with lib.maintainers; [
274 k900
275 ];
276 pkgConfigModules = [
277 "libpipewire-0.3"
278 "libspa-0.2"
279 ];
280 };
281})