diff options
-rw-r--r-- | nixos/modules/services/hardware/bluetooth.nix | 51 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd-lib.nix | 8 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd-unit-options.nix | 6 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 16 | ||||
-rw-r--r-- | pkgs/os-specific/linux/bluez/default.nix | 4 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
6 files changed, 40 insertions, 47 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" ]; + }; }; diff --git a/nixos/modules/system/boot/systemd-lib.nix b/nixos/modules/system/boot/systemd-lib.nix index 997770b8beca..7dbf3b25cdb0 100644 --- a/nixos/modules/system/boot/systemd-lib.nix +++ b/nixos/modules/system/boot/systemd-lib.nix @@ -159,7 +159,13 @@ rec { fi done - # Created .wants and .requires symlinks from the wantedBy and + # Create service aliases from aliases option. + ${concatStrings (mapAttrsToList (name: unit: + concatMapStrings (name2: '' + ln -sfn '${name}' $out/'${name2}' + '') unit.aliases) units)} + + # Create .wants and .requires symlinks from the wantedBy and # requiredBy options. ${concatStrings (mapAttrsToList (name: unit: concatMapStrings (name2: '' diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index 69af23981485..904e41b019fb 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -52,6 +52,12 @@ in rec { description = "Units that want (i.e. depend on) this unit."; }; + aliases = mkOption { + default = []; + type = types.listOf types.str; + description = "Aliases of that unit."; + }; + }; concreteUnitOptions = sharedOptions // { diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index ace1545b96e6..0ed3c083f7c4 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -313,7 +313,7 @@ let ''; targetToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = '' [Unit] @@ -322,7 +322,7 @@ let }; serviceToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = commonUnitText def + '' [Service] @@ -342,7 +342,7 @@ let }; socketToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = commonUnitText def + '' [Socket] @@ -352,7 +352,7 @@ let }; timerToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = commonUnitText def + '' [Timer] @@ -361,7 +361,7 @@ let }; pathToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = commonUnitText def + '' [Path] @@ -370,7 +370,7 @@ let }; mountToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = commonUnitText def + '' [Mount] @@ -379,7 +379,7 @@ let }; automountToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = commonUnitText def + '' [Automount] @@ -388,7 +388,7 @@ let }; sliceToUnit = name: def: - { inherit (def) wantedBy requiredBy enable; + { inherit (def) aliases wantedBy requiredBy enable; text = commonUnitText def + '' [Slice] diff --git a/pkgs/os-specific/linux/bluez/default.nix b/pkgs/os-specific/linux/bluez/default.nix index 9943a1de6d4b..d0a875516fa3 100644 --- a/pkgs/os-specific/linux/bluez/default.nix +++ b/pkgs/os-specific/linux/bluez/default.nix @@ -5,8 +5,8 @@ assert stdenv.isLinux; let inherit (pythonPackages) python; - pythonpath = "${pythonPackages.dbus}/lib/${python.libPrefix}/site-packages:" - + "${pythonPackages.pygobject}/lib/${python.libPrefix}/site-packages"; + pythonpath = "${pythonPackages.dbus-python}/lib/${python.libPrefix}/site-packages:" + + "${pythonPackages.pygobject2}/lib/${python.libPrefix}/site-packages"; in stdenv.mkDerivation rec { name = "bluez-4.101"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cb563c749b43..5a28aa5ea909 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10861,6 +10861,8 @@ with pkgs; bluez5 = callPackage ../os-specific/linux/bluez/bluez5.nix { }; + bluez4 = callPackage ../os-specific/linux/bluez { }; + # Needed for LibreOffice bluez5_28 = lowPrio (callPackage ../os-specific/linux/bluez/bluez5_28.nix { }); |