at 18.03-beta 86 lines 2.6 kB view raw
1{ stdenv, fetchurl, pkgconfig, dbus, glib, alsaLib, 2 pythonPackages, readline, udev, libical, 3 systemd, enableWiimote ? false }: 4 5assert stdenv.isLinux; 6 7stdenv.mkDerivation rec { 8 name = "bluez-5.48"; 9 10 src = fetchurl { 11 url = "mirror://kernel/linux/bluetooth/${name}.tar.xz"; 12 sha256 = "140fjyxa2q4y35d9n52vki649jzb094pf71hxkkvlrpgf8q75a5r"; 13 }; 14 15 pythonPath = with pythonPackages; 16 [ dbus-python pygobject2 pygobject3 recursivePthLoader ]; 17 18 buildInputs = [ 19 pkgconfig dbus glib alsaLib pythonPackages.python pythonPackages.wrapPython 20 readline udev libical 21 ]; 22 23 outputs = [ "out" "dev" "test" ]; 24 25 patches = [ ./bluez-5.37-obexd_without_systemd-1.patch ]; 26 27 preConfigure = '' 28 substituteInPlace tools/hid2hci.rules --replace /sbin/udevadm ${systemd}/bin/udevadm 29 substituteInPlace tools/hid2hci.rules --replace "hid2hci " "$out/lib/udev/hid2hci " 30 ''; 31 32 configureFlags = [ 33 "--localstatedir=/var" 34 "--enable-library" 35 "--enable-cups" 36 "--enable-pie" 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 postInstall = '' 52 mkdir -p $test/{bin,test} 53 cp -a test $test 54 pushd $test/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 $test/bin/bluez-$a 64 done 65 popd 66 wrapPythonProgramsIn $test/test "$test/test $pythonPath" 67 68 # for bluez4 compatibility for NixOS 69 mkdir $out/sbin 70 ln -s ../libexec/bluetooth/bluetoothd $out/sbin/bluetoothd 71 ln -s ../libexec/bluetooth/obexd $out/sbin/obexd 72 73 # Add extra configuration 74 mkdir $out/etc/bluetooth 75 ln -s /etc/bluetooth/main.conf $out/etc/bluetooth/main.conf 76 ''; 77 78 enableParallelBuilding = true; 79 80 meta = with stdenv.lib; { 81 homepage = http://www.bluez.org/; 82 repositories.git = https://git.kernel.org/pub/scm/bluetooth/bluez.git; 83 description = "Bluetooth support for Linux"; 84 platforms = platforms.linux; 85 }; 86}