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.28";
9
10 src = fetchurl {
11 url = "mirror://kernel/linux/bluetooth/${name}.tar.xz";
12 sha256 = "1a8qzh38wpq5c0rydpx9isf0jc6g14g2qs18j1rmi8a79f7v9fl5";
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 preConfigure = ''
27 substituteInPlace tools/hid2hci.rules --replace /sbin/udevadm ${systemd}/bin/udevadm
28 substituteInPlace tools/hid2hci.rules --replace "hid2hci " "$out/lib/udev/hid2hci "
29 '';
30
31 configureFlags = [
32 "--localstatedir=/var"
33 "--enable-library"
34 "--enable-cups"
35 "--with-dbusconfdir=$(out)/etc"
36 "--with-dbussystembusdir=$(out)/share/dbus-1/system-services"
37 "--with-dbussessionbusdir=$(out)/share/dbus-1/services"
38 "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
39 "--with-systemduserunitdir=$(out)/etc/systemd/user"
40 "--with-udevdir=$(out)/lib/udev"
41 ] ++
42 stdenv.lib.optional enableWiimote [ "--enable-wiimote" ];
43
44 # Work around `make install' trying to create /var/lib/bluetooth.
45 installFlags = "statedir=$(TMPDIR)/var/lib/bluetooth";
46
47 makeFlags = "rulesdir=$(out)/lib/udev/rules.d";
48
49 # FIXME: Move these into a separate package to prevent Bluez from
50 # depending on Python etc.
51 postInstall = ''
52 mkdir $out/test
53 cp -a test $out
54 pushd $out/test
55 for a in \
56 simple-agent \
57 test-adapter \
58 test-device \
59 test-thermometer \
60 list-devices \
61 monitor-bluetooth \
62 ; do
63 ln -s ../test/$a $out/bin/bluez-$a
64 done
65 popd
66 wrapPythonProgramsIn $out/test "$out/test $pythonPath"
67
68 # for bluez4 compatibility for NixOS
69 mkdir $out/sbin
70 ln -s ../libexec/bluetooth/bluetoothd $out/sbin/bluetoothd
71 '';
72
73 meta = with stdenv.lib; {
74 homepage = http://www.bluez.org/;
75 repositories.git = https://git.kernel.org/pub/scm/bluetooth/bluez.git;
76 description = "Bluetooth support for Linux";
77 platforms = platforms.linux;
78 };
79}