1{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook
2, alsa-lib, bluez, glib, sbc, dbus
3
4# optional, but useful utils
5, readline, libbsd, ncurses
6
7# optional codecs
8, aacSupport ? true, fdk_aac
9# TODO: aptxSupport
10}:
11
12stdenv.mkDerivation rec {
13 pname = "bluez-alsa";
14 version = "4.0.0";
15
16 src = fetchFromGitHub {
17 owner = "Arkq";
18 repo = "bluez-alsa";
19 rev = "v${version}";
20 sha256 = "sha256-Dp3O41nzo7j5rqxDEkR4bFPv0CNGOO4kWXAf8iy+jDg=";
21 };
22
23 nativeBuildInputs = [ pkg-config autoreconfHook ];
24
25 buildInputs = [
26 alsa-lib bluez glib sbc dbus
27 readline libbsd ncurses
28 ]
29 ++ lib.optional aacSupport fdk_aac;
30
31 configureFlags = [
32 "--with-alsaplugindir=${placeholder "out"}/lib/alsa-lib"
33 "--with-dbusconfdir=${placeholder "out"}/share/dbus-1/system.d"
34 "--enable-rfcomm"
35 "--enable-hcitop"
36 ]
37 ++ lib.optional aacSupport "--enable-aac";
38
39 meta = with lib; {
40 description = "Bluez 5 Bluetooth Audio ALSA Backend";
41 longDescription = ''
42 Bluez-ALSA (BlueALSA) is an ALSA backend for Bluez 5 audio interface.
43 Bluez-ALSA registers all Bluetooth devices with audio profiles in Bluez
44 under a virtual ALSA PCM device called `bluealsa` that supports both
45 playback and capture.
46
47 Some backstory: Bluez 5 removed built-in support for ALSA in favor of a
48 generic interface for 3rd party appliations. Thereafter, PulseAudio
49 implemented a backend for that interface and became the only way to get
50 Bluetooth audio with Bluez 5. Users prefering ALSA stayed on Bluez 4.
51 However, Bluez 4 eventually became deprecated.
52
53 This package is a rebirth of a direct interface between ALSA and Bluez 5,
54 that, unlike PulseAudio, provides KISS near-metal-like experience. It is
55 not possible to run BluezALSA and PulseAudio Bluetooth at the same time
56 due to limitations in Bluez, but it is possible to run PulseAudio over
57 BluezALSA if you disable `bluetooth-discover` and `bluez5-discover`
58 modules in PA and configure it to play/capture sound over `bluealsa` PCM.
59 '';
60 homepage = src.meta.homepage;
61 license = licenses.mit;
62 platforms = platforms.linux;
63 maintainers = [ maintainers.oxij ];
64 };
65
66}