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
223
224
225
226
227
228
|
{ stdenv
, lib
, fetchFromGitLab
, removeReferencesTo
, python3
, meson
, ninja
, systemd
, pkg-config
, docutils
, doxygen
, graphviz
, valgrind
, glib
, dbus
, alsa-lib
, libjack2
, libusb1
, udev
, libva
, libsndfile
, SDL2
, vulkan-headers
, vulkan-loader
, webrtc-audio-processing
, ncurses
, makeFontsConf
, callPackage
, nixosTests
, withMediaSession ? true
, gstreamerSupport ? true
, gst_all_1 ? null
, ffmpegSupport ? true
, ffmpeg ? null
, bluezSupport ? true
, bluez ? null
, sbc ? null
, libfreeaptx ? null
, ldacbt ? null
, fdk_aac ? null
, nativeHspSupport ? true
, nativeHfpSupport ? true
, ofonoSupport ? true
, hsphfpdSupport ? true
, pulseTunnelSupport ? true
, libpulseaudio ? null
, zeroconfSupport ? true
, avahi ? null
}:
let
fontsConf = makeFontsConf {
fontDirectories = [ ];
};
mesonEnable = b: if b then "enabled" else "disabled";
mesonList = l: "[" + lib.concatStringsSep "," l + "]";
self = stdenv.mkDerivation rec {
pname = "pipewire";
version = "0.3.36";
outputs = [
"out"
"lib"
"pulse"
"jack"
"dev"
"doc"
"man"
"mediaSession"
"installedTests"
];
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "pipewire";
rev = version;
sha256 = "sha256-kwoffB0Hi84T4Q0NaxLxsCyPV4R0LayX9kHmXU/vRPA=";
};
patches = [
# Break up a dependency cycle between outputs.
./0040-alsa-profiles-use-libdir.patch
# Change the path of the pipewire-pulse binary in the service definition.
./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
# Add option for changing the config install directory
./0080-pipewire-config-dir.patch
# Remove output paths from the comments in the config templates to break dependency cycles
./0090-pipewire-config-template-paths.patch
];
nativeBuildInputs = [
docutils
doxygen
graphviz
meson
ninja
pkg-config
python3
];
buildInputs = [
alsa-lib
dbus
glib
libjack2
libusb1
libsndfile
ncurses
udev
vulkan-headers
vulkan-loader
webrtc-audio-processing
valgrind
SDL2
systemd
] ++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ]
++ lib.optional ffmpegSupport ffmpeg
++ lib.optionals bluezSupport [ bluez libfreeaptx ldacbt sbc fdk_aac ]
++ lib.optional pulseTunnelSupport libpulseaudio
++ lib.optional zeroconfSupport avahi;
mesonFlags = [
"-Ddocs=enabled"
"-Dexamples=${mesonEnable withMediaSession}" # only needed for `pipewire-media-session`
"-Dudevrulesdir=lib/udev/rules.d"
"-Dinstalled_tests=enabled"
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
"-Dpipewire_pulse_prefix=${placeholder "pulse"}"
"-Dmedia-session-prefix=${placeholder "mediaSession"}"
"-Dlibjack-path=${placeholder "jack"}/lib"
"-Dlibcamera=disabled"
"-Droc=disabled"
"-Dlibpulse=${mesonEnable pulseTunnelSupport}"
"-Davahi=${mesonEnable zeroconfSupport}"
"-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}"
"-Dsysconfdir=/etc"
"-Dpipewire_confdata_dir=${placeholder "lib"}/share/pipewire"
"-Dsession-managers=${mesonList (lib.optional withMediaSession "media-session")}"
];
FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
doCheck = true;
postUnpack = ''
patchShebangs source/doc/strip-static.sh
patchShebangs source/spa/tests/gen-cpp-test.py
'';
postInstall = ''
pushd $lib/share
mkdir -p $out/nix-support/etc/pipewire
for f in pipewire/*.conf; do
echo "Generating JSON from $f"
$out/bin/spa-json-dump "$f" > "$out/nix-support/etc/$f.json"
done
mkdir -p $mediaSession/nix-support/etc/pipewire/media-session.d
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
popd
moveToOutput "share/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"
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
moveToOutput "bin/pipewire-pulse" "$pulse"
'';
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"
"nix-support/etc/pipewire/client-rt.conf.json"
"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"
"nix-support/etc/pipewire/media-session.d/bluez-hardware.conf.json"
"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"
];
};
};
};
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 ];
};
};
in
self
|