From fb9155a57662b9c1bbcb7d79fcbe9b1cdcff70dd Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 29 Aug 2025 01:50:59 +0200 Subject: [PATCH] bluez-headers: expose bluez header files This escapes infinite recursion, because Python cannot depend on bluez due to infinite recursion on multiple paths. But it only wants bluetooth.h at build time, so this is sufficient. In 5.84 the source path changes from lib/ to lib/bluetooth, which will require an update to the install phase. --- pkgs/by-name/bl/bluez-headers/package.nix | 44 +++++++++++++++++++++++ pkgs/by-name/bl/bluez/package.nix | 21 ++--------- 2 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 pkgs/by-name/bl/bluez-headers/package.nix diff --git a/pkgs/by-name/bl/bluez-headers/package.nix b/pkgs/by-name/bl/bluez-headers/package.nix new file mode 100644 index 000000000000..e9ee013982e5 --- /dev/null +++ b/pkgs/by-name/bl/bluez-headers/package.nix @@ -0,0 +1,44 @@ +{ + lib, + stdenv, + fetchurl, +}: + +# This package only provides the bluetooth headers from the bluez package +# for consumption in Python, which cannot consume bluez.dev due to multiple +# infinite recursion paths. + +stdenv.mkDerivation (finalAttrs: { + pname = "bluez-headers"; + version = "5.83"; + + # This package has the source, because of the emulatorAvailable check in the + # bluez function args, that causes an infinite recursion with Python on cross + # builds. + src = fetchurl { + url = "mirror://kernel/linux/bluetooth/bluez-${finalAttrs.version}.tar.xz"; + hash = "sha256-EIUi2QnSIFgTmb/sk9qrYgNVOc7vPdo+eZcHhcY70kw="; + }; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + mkdir -p $out/include/bluetooth + cp -v lib/*.h "$out/include/bluetooth/" + ''; + + meta = { + homepage = "https://www.bluez.org/"; + description = "Official Linux Bluetooth protocol stack"; + changelog = "https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/ChangeLog?h=${finalAttrs.version}"; + license = with lib.licenses; [ + bsd2 + gpl2Plus + lgpl21Plus + mit + ]; + maintainers = with lib.maintainers; [ ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/by-name/bl/bluez/package.nix b/pkgs/by-name/bl/bluez/package.nix index 7b11f0fefbec..8228902a3c38 100644 --- a/pkgs/by-name/bl/bluez/package.nix +++ b/pkgs/by-name/bl/bluez/package.nix @@ -3,6 +3,7 @@ stdenv, alsa-lib, autoreconfHook, + bluez-headers, dbus, docutils, ell, @@ -28,12 +29,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "bluez"; - version = "5.83"; - - src = fetchurl { - url = "mirror://kernel/linux/bluetooth/bluez-${finalAttrs.version}.tar.xz"; - hash = "sha256-EIUi2QnSIFgTmb/sk9qrYgNVOc7vPdo+eZcHhcY70kw="; - }; + inherit (bluez-headers) version src; patches = [ (fetchurl { @@ -186,18 +182,7 @@ stdenv.mkDerivation (finalAttrs: { url = "https://git.kernel.org/pub/scm/bluetooth/bluez.git"; }; - meta = { - homepage = "https://www.bluez.org/"; - description = "Official Linux Bluetooth protocol stack"; - changelog = "https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/ChangeLog?h=${finalAttrs.version}"; - license = with lib.licenses; [ - bsd2 - gpl2Plus - lgpl21Plus - mit - ]; + meta = bluez-headers.meta // { mainProgram = "btinfo"; - maintainers = with lib.maintainers; [ ]; - platforms = lib.platforms.linux; }; })