1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
{ stdenv
, lib
, buildPackages
, fetchFromGitLab
, fetchpatch
, python3
, meson
, ninja
, eudev
, systemd
, enableSystemd ? true
, pkg-config
, docutils
, doxygen
, graphviz
, glib
, dbus
, alsa-lib
, libjack2
, libusb1
, udev
, libsndfile
, vulkan-headers
, vulkan-loader
, webrtc-audio-processing
, webrtc-audio-processing_1
, ncurses
, readline # meson can't find <7 as those versions don't have a .pc file
, lilv
, makeFontsConf
, callPackage
, nixosTests
, withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind
, valgrind
, libcameraSupport ? true
, libcamera
, libdrm
, gstreamerSupport ? true
, gst_all_1
, ffmpegSupport ? true
, ffmpeg
, bluezSupport ? true
, bluez
, sbc
, libfreeaptx
, liblc3
, fdk_aac
, libopus
, ldacbtSupport ? bluezSupport && lib.meta.availableOn stdenv.hostPlatform ldacbt
, ldacbt
, nativeHspSupport ? true
, nativeHfpSupport ? true
, nativeModemManagerSupport ? true
, modemmanager
, ofonoSupport ? true
, hsphfpdSupport ? true
, pulseTunnelSupport ? true
, libpulseaudio
, zeroconfSupport ? true
, avahi
, raopSupport ? true
, openssl
, rocSupport ? true
, roc-toolkit
, x11Support ? true
, libcanberra
, xorg
, mysofaSupport ? true
, libmysofa
, tinycompress
, ffadoSupport ? x11Support && stdenv.buildPlatform.canExecute stdenv.hostPlatform
, ffado
, libselinux
}:
# Bluetooth codec only makes sense if general bluetooth enabled
assert ldacbtSupport -> bluezSupport;
let
mesonEnableFeature = b: if b then "enabled" else "disabled";
self = stdenv.mkDerivation rec {
pname = "pipewire";
version = "1.0.1";
outputs = [
"out"
"jack"
"dev"
"doc"
"man"
"installedTests"
];
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "pipewire";
rev = version;
sha256 = "sha256-rvf0sZRgDDLcqroLg7hcMUqXD/4JT+3lBRX6/m+3Ry8=";
};
patches = [
# Load libjack from a known location
./0060-libjack-path.patch
# Move installed tests into their own output.
./0070-installed-tests-path.patch
];
strictDeps = true;
nativeBuildInputs = [
docutils
doxygen
graphviz
meson
ninja
pkg-config
python3
glib
];
buildInputs = [
alsa-lib
dbus
glib
libjack2
libusb1
libselinux
libsndfile
lilv
ncurses
readline
udev
vulkan-headers
vulkan-loader
tinycompress
] ++ (if enableSystemd then [ systemd ] else [ eudev ])
++ (if lib.meta.availableOn stdenv.hostPlatform webrtc-audio-processing_1 then [ webrtc-audio-processing_1 ] else [ webrtc-audio-processing ])
++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ]
++ lib.optionals libcameraSupport [ libcamera libdrm ]
++ lib.optional ffmpegSupport ffmpeg
++ lib.optionals bluezSupport [ bluez libfreeaptx liblc3 sbc fdk_aac libopus ]
++ lib.optional ldacbtSupport ldacbt
++ lib.optional nativeModemManagerSupport modemmanager
++ lib.optional pulseTunnelSupport libpulseaudio
++ lib.optional zeroconfSupport avahi
++ lib.optional raopSupport openssl
++ lib.optional rocSupport roc-toolkit
++ lib.optionals x11Support [ libcanberra xorg.libX11 xorg.libXfixes ]
++ lib.optional mysofaSupport libmysofa
++ lib.optional ffadoSupport ffado;
# Valgrind binary is required for running one optional test.
nativeCheckInputs = lib.optional withValgrind valgrind;
mesonFlags = [
"-Ddocs=enabled"
"-Dudevrulesdir=lib/udev/rules.d"
"-Dinstalled_tests=enabled"
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
"-Dlibjack-path=${placeholder "jack"}/lib"
"-Dlibcamera=${mesonEnableFeature libcameraSupport}"
"-Dlibffado=${mesonEnableFeature ffadoSupport}"
"-Droc=${mesonEnableFeature rocSupport}"
"-Dlibpulse=${mesonEnableFeature pulseTunnelSupport}"
"-Davahi=${mesonEnableFeature zeroconfSupport}"
"-Dgstreamer=${mesonEnableFeature gstreamerSupport}"
"-Dsystemd-system-service=${mesonEnableFeature enableSystemd}"
"-Dudev=${mesonEnableFeature (!enableSystemd)}"
"-Dffmpeg=${mesonEnableFeature ffmpegSupport}"
"-Dbluez5=${mesonEnableFeature bluezSupport}"
"-Dbluez5-backend-hsp-native=${mesonEnableFeature nativeHspSupport}"
"-Dbluez5-backend-hfp-native=${mesonEnableFeature nativeHfpSupport}"
"-Dbluez5-backend-native-mm=${mesonEnableFeature nativeModemManagerSupport}"
"-Dbluez5-backend-ofono=${mesonEnableFeature ofonoSupport}"
"-Dbluez5-backend-hsphfpd=${mesonEnableFeature hsphfpdSupport}"
# source code is not easily obtainable
"-Dbluez5-codec-lc3plus=disabled"
"-Dbluez5-codec-lc3=${mesonEnableFeature bluezSupport}"
"-Dbluez5-codec-ldac=${mesonEnableFeature ldacbtSupport}"
"-Dsysconfdir=/etc"
"-Draop=${mesonEnableFeature raopSupport}"
"-Dsession-managers="
"-Dvulkan=enabled"
"-Dx11=${mesonEnableFeature x11Support}"
"-Dx11-xfixes=${mesonEnableFeature x11Support}"
"-Dlibcanberra=${mesonEnableFeature x11Support}"
"-Dlibmysofa=${mesonEnableFeature mysofaSupport}"
"-Dsdl2=disabled" # required only to build examples, causes dependency loop
"-Drlimits-install=false" # installs to /etc, we won't use this anyway
"-Dcompress-offload=enabled"
"-Dman=enabled"
];
# Fontconfig error: Cannot load default config file
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
doCheck = true;
postUnpack = ''
patchShebangs source/doc/*.py
patchShebangs source/doc/input-filter-h.sh
'';
postInstall = ''
moveToOutput "bin/pw-jack" "$jack"
'';
passthru.tests.installed-tests = nixosTests.installed-tests.pipewire;
meta = with lib; {
description = "Server and user space API to deal with multimedia pipelines";
changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${version}";
homepage = "https://pipewire.org/";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ kranzes k900 ];
};
};
in
self
|