lol
1{ lib, stdenv, fetchurl, pkgconfig, intltool, autoreconfHook
2, json_c, libsndfile, libtool
3, xorg, libcap, alsaLib, glib
4, avahi, libjack2, libasyncns, lirc, dbus
5, sbc, bluez5, udev, openssl, fftwFloat
6, speexdsp, systemd, webrtc-audio-processing, gconf ? null
7
8# Database selection
9, tdb ? null, gdbm ? null
10
11, x11Support ? false
12
13, useSystemd ? true
14
15, # Whether to support the JACK sound system as a backend.
16 jackaudioSupport ? false
17
18, # Whether to build the OSS wrapper ("padsp").
19 ossWrapper ? true
20
21, airtunesSupport ? false
22
23, gconfSupport ? false
24
25, bluetoothSupport ? false
26
27, remoteControlSupport ? false
28
29, zeroconfSupport ? false
30
31, # Whether to build only the library.
32 libOnly ? false
33}:
34
35stdenv.mkDerivation rec {
36 name = "${if libOnly then "lib" else ""}pulseaudio-${version}";
37 version = "9.0";
38
39 src = fetchurl {
40 url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${version}.tar.xz";
41 sha256 = "11j682g2mn723sz3bh4i44ggq29z053zcggy0glzn63zh9mxdly3";
42 };
43
44 patches = [ ./caps-fix.patch ];
45
46 outputs = [ "out" "dev" ];
47
48 nativeBuildInputs = [ pkgconfig intltool autoreconfHook ];
49
50 propagatedBuildInputs =
51 lib.optionals stdenv.isLinux [ libcap ];
52
53 buildInputs =
54 [ json_c libsndfile speexdsp fftwFloat ]
55 ++ lib.optionals stdenv.isLinux [ glib dbus ]
56 ++ lib.optionals (!libOnly) (
57 [ libasyncns webrtc-audio-processing ]
58 ++ lib.optional jackaudioSupport libjack2
59 ++ lib.optionals x11Support [ xorg.xlibsWrapper xorg.libXtst xorg.libXi ]
60 ++ lib.optional useSystemd systemd
61 ++ lib.optionals stdenv.isLinux [ alsaLib udev ]
62 ++ lib.optional airtunesSupport openssl
63 ++ lib.optional gconfSupport gconf
64 ++ lib.optionals bluetoothSupport [ bluez5 sbc ]
65 ++ lib.optional remoteControlSupport lirc
66 ++ lib.optional zeroconfSupport avahi
67 );
68
69 preConfigure = ''
70 # Performs and autoreconf
71 export NOCONFIGURE="yes"
72 patchShebangs bootstrap.sh
73 ./bootstrap.sh
74
75 # Move the udev rules under $(prefix).
76 sed -i "src/Makefile.in" \
77 -e "s|udevrulesdir[[:blank:]]*=.*$|udevrulesdir = $out/lib/udev/rules.d|g"
78
79 # don't install proximity-helper as root and setuid
80 sed -i "src/Makefile.in" \
81 -e "s|chown root|true |" \
82 -e "s|chmod r+s |true |"
83 '';
84
85 configureFlags =
86 [ "--disable-solaris"
87 "--disable-jack"
88 "--disable-oss-output"
89 ] ++ lib.optional (!ossWrapper) "--disable-oss-wrapper" ++
90 [ "--localstatedir=/var"
91 "--sysconfdir=/etc"
92 "--with-access-group=audio"
93 "--with-bash-completion-dir=\${out}/share/bash-completions/completions"
94 ]
95 ++ lib.optional (jackaudioSupport && !libOnly) "--enable-jack"
96 ++ lib.optional stdenv.isDarwin "--with-mac-sysroot=/"
97 ++ lib.optional (stdenv.isLinux && useSystemd) "--with-systemduserunitdir=\${out}/lib/systemd/user";
98
99 enableParallelBuilding = true;
100
101 # not sure what the best practices are here -- can't seem to find a way
102 # for the compiler to bring in stdlib and stdio (etc.) properly
103 # the alternative is to copy the files from /usr/include to src, but there are
104 # probably a large number of files that would need to be copied (I stopped
105 # after the seventh)
106 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I/usr/include";
107
108 installFlags =
109 [ "sysconfdir=$(out)/etc"
110 "pulseconfdir=$(out)/etc/pulse"
111 ];
112
113 postInstall = lib.optionalString libOnly ''
114 rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
115 sed 's|-lltdl|-L${libtool.lib}/lib -lltdl|' -i $out/lib/pulseaudio/libpulsecore-${version}.la
116 ''
117 + ''moveToOutput lib/cmake "$dev" '';
118
119 meta = {
120 description = "Sound server for POSIX and Win32 systems";
121 homepage = http://www.pulseaudio.org/;
122 licenses = lib.licenses.lgpl2Plus;
123 maintainers = with lib.maintainers; [ lovek323 wkennington ];
124 platforms = lib.platforms.unix;
125
126 longDescription = ''
127 PulseAudio is a sound server for POSIX and Win32 systems. A
128 sound server is basically a proxy for your sound applications.
129 It allows you to do advanced operations on your sound data as it
130 passes between your application and your hardware. Things like
131 transferring the audio to a different machine, changing the
132 sample format or channel count and mixing several sounds into
133 one are easily achieved using a sound server.
134 '';
135 };
136}