1{
2 stdenv,
3 lib,
4 config,
5 fetchFromGitHub,
6 cmake,
7 pkg-config,
8 alsaSupport ? stdenv.hostPlatform.isLinux,
9 alsa-lib,
10 pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux,
11 libpulseaudio,
12 jackSupport ? true,
13 jack,
14 coreaudioSupport ? stdenv.hostPlatform.isDarwin,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "rtaudio";
19 version = "5.2.0";
20
21 # nixpkgs-update: no auto update
22 src = fetchFromGitHub {
23 owner = "thestk";
24 repo = "rtaudio";
25 rev = version;
26 sha256 = "0xvahlfj3ysgsjsp53q81hayzw7f99n1g214gh7dwdr52kv2l987";
27 };
28
29 nativeBuildInputs = [
30 cmake
31 pkg-config
32 ];
33
34 buildInputs =
35 lib.optional alsaSupport alsa-lib
36 ++ lib.optional pulseaudioSupport libpulseaudio
37 ++ lib.optional jackSupport jack;
38
39 cmakeFlags = [
40 "-DRTAUDIO_API_ALSA=${if alsaSupport then "ON" else "OFF"}"
41 "-DRTAUDIO_API_PULSE=${if pulseaudioSupport then "ON" else "OFF"}"
42 "-DRTAUDIO_API_JACK=${if jackSupport then "ON" else "OFF"}"
43 "-DRTAUDIO_API_CORE=${if coreaudioSupport then "ON" else "OFF"}"
44 ];
45
46 meta = with lib; {
47 description = "Set of C++ classes that provide a cross platform API for realtime audio input/output";
48 homepage = "https://www.music.mcgill.ca/~gary/rtaudio/";
49 license = licenses.mit;
50 maintainers = with maintainers; [ magnetophon ];
51 platforms = platforms.unix;
52 };
53}