diff options
author | Nikolay Amiantov <ab@fmap.me> | 2017-02-02 00:52:12 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2017-02-02 00:52:54 +0300 |
commit | 4abcef2ba19a73ea212f6812b395e8e3ac698fd5 (patch) | |
tree | 9962bec2c0573caa2782339186c16f85a9fb63cb /nixos/modules/services/hardware/bluetooth.nix | |
parent | 496476be4ed3d8e81213ccb7240fd91fdcf83e15 (diff) |
bluez service: use upstream units
Diffstat (limited to 'nixos/modules/services/hardware/bluetooth.nix')
-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 2c271b3281794..f6cf2d01d809f 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" ]; + }; }; |