kde5 bluedevil plasmoid : enable bluez5 bluetooth functionality

- Fixed a bug in bluedevil (link to a .js file)
- Made bluez5 the default bluetooth service except for kde4
- created org.bluez.obex systemd dbus service
- Patched bluez5 using bluez-5.37-obexd_without_systemd-1.patch
in order to enable obex when using either the bluedevil plasmoid
or dolpin file manager within plasma workspaces 5.

The functionality was tested using a Sony Xperia Z, the machine
and the handset paired and two different files were sent in both
directions successfully.

+110 -17
+43 -17
nixos/modules/services/hardware/bluetooth.nix
··· 1 { config, lib, pkgs, ... }: 2 3 with lib; 4 5 { 6 ··· 16 17 }; 18 19 - 20 ###### implementation 21 - 22 config = mkIf config.hardware.bluetooth.enable { 23 24 - environment.systemPackages = [ pkgs.bluez pkgs.openobex pkgs.obexftp ]; 25 - 26 - services.udev.packages = [ pkgs.bluez ]; 27 - 28 - services.dbus.packages = [ pkgs.bluez ]; 29 - 30 - systemd.services."dbus-org.bluez" = { 31 - description = "Bluetooth Service"; 32 - serviceConfig = { 33 - Type = "dbus"; 34 - BusName = "org.bluez"; 35 - ExecStart = "${pkgs.bluez}/sbin/bluetoothd -n"; 36 - }; 37 - wantedBy = [ "bluetooth.target" ]; 38 - }; 39 40 }; 41
··· 1 { config, lib, pkgs, ... }: 2 3 with lib; 4 + let 5 + bluez-bluetooth = if config.services.xserver.desktopManager.kde4.enable then pkgs.bluez else pkgs.bluez5; 6 + 7 + configBluez = { 8 + description = "Bluetooth Service"; 9 + serviceConfig = { 10 + Type = "dbus"; 11 + BusName = "org.bluez"; 12 + ExecStart = "${bluez-bluetooth}/sbin/bluetoothd -n"; 13 + }; 14 + wantedBy = [ "bluetooth.target" ]; 15 + }; 16 + 17 + configBluez5 = { 18 + description = "Bluetooth Service"; 19 + serviceConfig = { 20 + Type = "dbus"; 21 + BusName = "org.bluez"; 22 + ExecStart = "${bluez-bluetooth}/sbin/bluetoothd -n"; 23 + NotifyAccess="main"; 24 + CapabilityBoundingSet="CAP_NET_ADMIN CAP_NET_BIND_SERVICE"; 25 + LimitNPROC=1; 26 + }; 27 + wantedBy = [ "bluetooth.target" ]; 28 + }; 29 + 30 + obexConfig = { 31 + description = "Bluetooth OBEX service"; 32 + serviceConfig = { 33 + Type = "dbus"; 34 + BusName = "org.bluez.obex"; 35 + ExecStart = "${bluez-bluetooth}/sbin/obexd"; 36 + }; 37 + }; 38 + 39 + bluezConfig = if config.services.xserver.desktopManager.kde4.enable then configBluez else configBluez5; 40 + in 41 42 { 43 ··· 53 54 }; 55 56 ###### implementation 57 + 58 config = mkIf config.hardware.bluetooth.enable { 59 60 + environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ]; 61 + services.udev.packages = [ bluez-bluetooth ]; 62 + services.dbus.packages = [ bluez-bluetooth ]; 63 + systemd.services."dbus-org.bluez" = bluezConfig; 64 + systemd.services."dbus-org.bluez.obex" = obexConfig; 65 66 }; 67
+2
pkgs/desktops/plasma-5.5/bluedevil.nix
··· 20 postInstall = '' 21 wrapQtProgram "$out/bin/bluedevil-wizard" 22 wrapQtProgram "$out/bin/bluedevil-sendfile" 23 ''; 24 }
··· 20 postInstall = '' 21 wrapQtProgram "$out/bin/bluedevil-wizard" 22 wrapQtProgram "$out/bin/bluedevil-sendfile" 23 + # Fix the location of logic.js for the plasmoid 24 + ln -s $out/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/code/logic.js $out/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js 25 ''; 26 }
+61
pkgs/os-specific/linux/bluez/bluez-5.37-obexd_without_systemd-1.patch
···
··· 1 + Submitted By: Armin K. <krejzi at email dot com> 2 + Date: 2013-04-29 3 + Initial Package Version: 5.17 4 + Upstream Status: unknown 5 + Origin: Arch Linux (Giovanni Campagna) 6 + Description: Allow using obexd without systemd in the user session 7 + 8 + Not all sessions run systemd --user (actually, the majority 9 + doesn't), so the dbus daemon must be able to spawn obexd 10 + directly, and to do so it needs the full path of the daemon. 11 + --- 12 + Makefile.obexd | 4 ++-- 13 + obexd/src/org.bluez.obex.service | 4 ---- 14 + obexd/src/org.bluez.obex.service.in | 4 ++++ 15 + 3 files changed, 6 insertions(+), 6 deletions(-) 16 + delete mode 100644 obexd/src/org.bluez.obex.service 17 + create mode 100644 obexd/src/org.bluez.obex.service.in 18 + 19 + diff --git a/Makefile.obexd b/Makefile.obexd 20 + index 3760867..142e7c3 100644 21 + --- a/Makefile.obexd 22 + +++ b/Makefile.obexd 23 + @@ -2,12 +2,12 @@ 24 + if SYSTEMD 25 + systemduserunitdir = @SYSTEMD_USERUNITDIR@ 26 + systemduserunit_DATA = obexd/src/obex.service 27 + +endif 28 + 29 + dbussessionbusdir = @DBUS_SESSIONBUSDIR@ 30 + dbussessionbus_DATA = obexd/src/org.bluez.obex.service 31 + -endif 32 + 33 + -EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service 34 + +EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in 35 + 36 + obex_plugindir = $(libdir)/obex/plugins 37 + 38 + diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service 39 + deleted file mode 100644 40 + index a538088..0000000 41 + --- a/obexd/src/org.bluez.obex.service 42 + +++ /dev/null 43 + @@ -1,4 +0,0 @@ 44 + -[D-BUS Service] 45 + -Name=org.bluez.obex 46 + -Exec=/bin/false 47 + -SystemdService=dbus-org.bluez.obex.service 48 + diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in 49 + new file mode 100644 50 + index 0000000..9c815f2 51 + --- /dev/null 52 + +++ b/obexd/src/org.bluez.obex.service.in 53 + @@ -0,0 +1,4 @@ 54 + +[D-BUS Service] 55 + +Name=org.bluez.obex 56 + +Exec=@libexecdir@/obexd 57 + +SystemdService=dbus-org.bluez.obex.service 58 + -- 59 + 1.8.3.1 60 + 61 +
+3
pkgs/os-specific/linux/bluez/bluez5.nix
··· 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 " ··· 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; {
··· 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 " ··· 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 meta = with stdenv.lib; {
+1
pkgs/os-specific/linux/bluez/bluez5_28.nix
··· 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; {
··· 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 74 meta = with stdenv.lib; {