aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/bluetooth/bluez-alsa/default.nix
blob: 588049cb976b7d33de18e9ac845672ad950ead5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook
, alsaLib, bluez, glib, sbc, dbus

# optional, but useful utils
, readline, libbsd, ncurses

# optional codecs
, aacSupport ? true, fdk_aac
# TODO: aptxSupport
}:

with stdenv.lib;

stdenv.mkDerivation rec {
  pname = "bluez-alsa";
  version = "3.0.0";

  src = fetchFromGitHub {
    owner = "Arkq";
    repo = "bluez-alsa";
    rev = "v${version}";
    sha256 = "1jlsgxyqfhncfhx1sy3ry0dp6p95kd4agh7g2b7g51h0c4cv74h8";
  };

  nativeBuildInputs = [ pkgconfig autoreconfHook ];

  buildInputs = [
    alsaLib bluez glib sbc dbus
    readline libbsd ncurses
  ]
  ++ optional aacSupport fdk_aac;

  configureFlags = [
    "--with-alsaplugindir=${placeholder "out"}/lib/alsa-lib"
    "--with-dbusconfdir=${placeholder "out"}/share/dbus-1/system.d"
    "--enable-rfcomm"
    "--enable-hcitop"
  ]
  ++ optional aacSupport "--enable-aac";

  meta = {
    description = "Bluez 5 Bluetooth Audio ALSA Backend";
    longDescription = ''
      Bluez-ALSA (BlueALSA) is an ALSA backend for Bluez 5 audio interface.
      Bluez-ALSA registers all Bluetooth devices with audio profiles in Bluez
      under a virtual ALSA PCM device called `bluealsa` that supports both
      playback and capture.

      Some backstory: Bluez 5 removed built-in support for ALSA in favor of a
      generic interface for 3rd party appliations. Thereafter, PulseAudio
      implemented a backend for that interface and became the only way to get
      Bluetooth audio with Bluez 5. Users prefering ALSA stayed on Bluez 4.
      However, Bluez 4 eventually became deprecated.

      This package is a rebirth of a direct interface between ALSA and Bluez 5,
      that, unlike PulseAudio, provides KISS near-metal-like experience. It is
      not possible to run BluezALSA and PulseAudio Bluetooth at the same time
      due to limitations in Bluez, but it is possible to run PulseAudio over
      BluezALSA if you disable `bluetooth-discover` and `bluez5-discover`
      modules in PA and configure it to play/capture sound over `bluealsa` PCM.
    '';
    homepage = src.meta.homepage;
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = [ maintainers.oxij maintainers.lheckemann ];
  };

}