1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/nixos/modules/services/hardware/bluetooth.nix
Tony White ddfb660f7b 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.
2016-01-29 22:08:42 +00:00

69 lines
1.7 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
bluez-bluetooth = if config.services.xserver.desktopManager.kde4.enable then pkgs.bluez else pkgs.bluez5;
configBluez = {
description = "Bluetooth Service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez";
ExecStart = "${bluez-bluetooth}/sbin/bluetoothd -n";
};
wantedBy = [ "bluetooth.target" ];
};
configBluez5 = {
description = "Bluetooth Service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez";
ExecStart = "${bluez-bluetooth}/sbin/bluetoothd -n";
NotifyAccess="main";
CapabilityBoundingSet="CAP_NET_ADMIN CAP_NET_BIND_SERVICE";
LimitNPROC=1;
};
wantedBy = [ "bluetooth.target" ];
};
obexConfig = {
description = "Bluetooth OBEX service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez.obex";
ExecStart = "${bluez-bluetooth}/sbin/obexd";
};
};
bluezConfig = if config.services.xserver.desktopManager.kde4.enable then configBluez else configBluez5;
in
{
###### interface
options = {
hardware.bluetooth.enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable support for Bluetooth.";
};
};
###### implementation
config = mkIf config.hardware.bluetooth.enable {
environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
services.udev.packages = [ bluez-bluetooth ];
services.dbus.packages = [ bluez-bluetooth ];
systemd.services."dbus-org.bluez" = bluezConfig;
systemd.services."dbus-org.bluez.obex" = obexConfig;
};
}