diff options
author | Nikolay Amiantov <ab@fmap.me> | 2017-02-05 13:18:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-05 13:18:48 +0300 |
commit | 90bc1a8595792d87927a65db172f55aa22176944 (patch) | |
tree | bf00b59b2eb271c1e8573dd399519c1cd46c9723 /nixos/modules/services | |
parent | 91869fb8484f78dd5d4cb3abfb8542d00f3d0f2a (diff) | |
parent | 4abcef2ba19a73ea212f6812b395e8e3ac698fd5 (diff) | |
download | nixlib-90bc1a8595792d87927a65db172f55aa22176944.tar nixlib-90bc1a8595792d87927a65db172f55aa22176944.tar.gz nixlib-90bc1a8595792d87927a65db172f55aa22176944.tar.bz2 nixlib-90bc1a8595792d87927a65db172f55aa22176944.tar.lz nixlib-90bc1a8595792d87927a65db172f55aa22176944.tar.xz nixlib-90bc1a8595792d87927a65db172f55aa22176944.tar.zst nixlib-90bc1a8595792d87927a65db172f55aa22176944.zip |
Merge pull request #22353 from abbradar/bluetooth
Bluetooth improvements
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/hardware/bluetooth.nix | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix index 2c271b328179..f6cf2d01d809 100644 --- a/nixos/modules/services/hardware/bluetooth.nix +++ b/nixos/modules/services/hardware/bluetooth.nix @@ -2,41 +2,9 @@ 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 = "${getBin bluez-bluetooth}/bin/bluetoothd -n"; - }; - wantedBy = [ "bluetooth.target" ]; - }; - - configBluez5 = { - description = "Bluetooth Service"; - serviceConfig = { - Type = "dbus"; - BusName = "org.bluez"; - ExecStart = "${getBin bluez-bluetooth}/bin/bluetoothd -n"; - NotifyAccess="main"; - CapabilityBoundingSet="CAP_NET_ADMIN CAP_NET_BIND_SERVICE"; - LimitNPROC=1; - }; - wantedBy = [ "bluetooth.target" ]; - }; + isBluez4 = config.services.xserver.desktopManager.kde4.enable; + bluez-bluetooth = if isBluez4 then pkgs.bluez4 else pkgs.bluez; - obexConfig = { - description = "Bluetooth OBEX service"; - serviceConfig = { - Type = "dbus"; - BusName = "org.bluez.obex"; - ExecStart = "${getBin bluez-bluetooth}/bin/obexd"; - }; - }; - - bluezConfig = if config.services.xserver.desktopManager.kde4.enable then configBluez else configBluez5; in { @@ -58,10 +26,21 @@ in 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; + + systemd.packages = [ bluez-bluetooth ]; + + systemd.services.bluetooth = { + wantedBy = [ "bluetooth.target" ]; + aliases = [ "dbus-org.bluez.service" ]; + }; + + systemd.user.services.obex = mkIf (!isBluez4) { + aliases = [ "dbus-org.bluez.obex.service" ]; + }; }; |