git.iko.soy/typeable/nixpkgs
on master help sign in
bluez service: use upstream units
commit4abcef2ba19a73ea212f6812b395e8e3ac698fd5 authorNikolay Amiantov <ab@fmap.me> dateThu 2 Feb 2017, 00:52 (10 years ago) parent496476b
1 file changed+15−36
nixos/modules/services/hardware/bluetooth.nix+15−36
nixos/modules/services/hardware/bluetooth.nix+15−36
@@ -2,41 +2,9 @@
22
33with lib;
44let
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 = "${getBin bluez-bluetooth}/bin/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 = "${getBin bluez-bluetooth}/bin/bluetoothd -n";
23− NotifyAccess="main";
24− CapabilityBoundingSet="CAP_NET_ADMIN CAP_NET_BIND_SERVICE";
25− LimitNPROC=1;
26− };
27− wantedBy = [ "bluetooth.target" ];
28− };
5+ isBluez4 = config.services.xserver.desktopManager.kde4.enable;
6+ bluez-bluetooth = if isBluez4 then pkgs.bluez4 else pkgs.bluez;
297
30− obexConfig = {
31− description = "Bluetooth OBEX service";
32− serviceConfig = {
33− Type = "dbus";
34− BusName = "org.bluez.obex";
35− ExecStart = "${getBin bluez-bluetooth}/bin/obexd";
36− };
37− };
38−
39− bluezConfig = if config.services.xserver.desktopManager.kde4.enable then configBluez else configBluez5;
408in
419
4210{
@@ -58,10 +26,21 @@ in
5826 config = mkIf config.hardware.bluetooth.enable {
5927
6028 environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
29+
6130 services.udev.packages = [ bluez-bluetooth ];
31+
6232 services.dbus.packages = [ bluez-bluetooth ];
63− systemd.services."dbus-org.bluez" = bluezConfig;
64− systemd.services."dbus-org.bluez.obex" = obexConfig;
33+
34+ systemd.packages = [ bluez-bluetooth ];
35+
36+ systemd.services.bluetooth = {
37+ wantedBy = [ "bluetooth.target" ];
38+ aliases = [ "dbus-org.bluez.service" ];
39+ };
40+
41+ systemd.user.services.obex = mkIf (!isBluez4) {
42+ aliases = [ "dbus-org.bluez.obex.service" ];
43+ };
6544
6645 };
6746