lol
1{ stdenv, fetchurl, pkgconfig, dbus, glib, alsaLib, python,
2 pythonPackages, pythonDBus, readline, libsndfile, udev, libical,
3 systemd, enableWiimote ? false }:
4
5assert stdenv.isLinux;
6
7stdenv.mkDerivation rec {
8 name = "bluez-5.37";
9
10 src = fetchurl {
11 url = "mirror://kernel/linux/bluetooth/${name}.tar.xz";
12 sha256 = "c14ba9ddcb0055522073477b8fd8bf1ddf5d219e75fdfd4699b7e0ce5350d6b0";
13 };
14
15 pythonPath = with pythonPackages;
16 [ pythonDBus pygobject pygobject3 recursivePthLoader ];
17
18 buildInputs =
19 [ pkgconfig dbus.libs glib alsaLib python pythonPackages.wrapPython
20 readline libsndfile udev libical
21 # Disables GStreamer; not clear what it gains us other than a
22 # zillion extra dependencies.
23 # gstreamer gst_plugins_base
24 ];
25
26 patches = [ ./bluez-5.37-obexd_without_systemd-1.patch ];
27
28 preConfigure = ''
29 substituteInPlace tools/hid2hci.rules --replace /sbin/udevadm ${systemd}/bin/udevadm
30 substituteInPlace tools/hid2hci.rules --replace "hid2hci " "$out/lib/udev/hid2hci "
31 '';
32
33 configureFlags = [
34 "--localstatedir=/var"
35 "--enable-library"
36 "--enable-cups"
37 "--with-dbusconfdir=$(out)/etc"
38 "--with-dbussystembusdir=$(out)/share/dbus-1/system-services"
39 "--with-dbussessionbusdir=$(out)/share/dbus-1/services"
40 "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
41 "--with-systemduserunitdir=$(out)/etc/systemd/user"
42 "--with-udevdir=$(out)/lib/udev"
43 ] ++
44 stdenv.lib.optional enableWiimote [ "--enable-wiimote" ];
45
46 # Work around `make install' trying to create /var/lib/bluetooth.
47 installFlags = "statedir=$(TMPDIR)/var/lib/bluetooth";
48
49 makeFlags = "rulesdir=$(out)/lib/udev/rules.d";
50
51 # FIXME: Move these into a separate package to prevent Bluez from
52 # depending on Python etc.
53 postInstall = ''
54 mkdir $out/test
55 cp -a test $out
56 pushd $out/test
57 for a in \
58 simple-agent \
59 test-adapter \
60 test-device \
61 test-thermometer \
62 list-devices \
63 monitor-bluetooth \
64 ; do
65 ln -s ../test/$a $out/bin/bluez-$a
66 done
67 popd
68 wrapPythonProgramsIn $out/test "$out/test $pythonPath"
69
70 # for bluez4 compatibility for NixOS
71 mkdir $out/sbin
72 ln -s ../libexec/bluetooth/bluetoothd $out/sbin/bluetoothd
73 ln -s ../libexec/bluetooth/obexd $out/sbin/obexd
74 '';
75
76 enableParallelBuilding = true;
77
78 meta = with stdenv.lib; {
79 homepage = http://www.bluez.org/;
80 repositories.git = https://git.kernel.org/pub/scm/bluetooth/bluez.git;
81 description = "Bluetooth support for Linux";
82 platforms = platforms.linux;
83 };
84}