1 { lib, stdenv, fetchFromGitHub, fetchpatch2, pkg-config, python3Packages, makeWrapper
2 , libsamplerate, libsndfile, readline, eigen, celt
5 , aften, AudioUnit, CoreAudio, libobjc, Accelerate
7 # Optional Dependencies
8 , dbus ? null, libffado ? null, alsa-lib ? null
18 inherit (python3Packages) python dbus-python;
19 shouldUsePkg = pkg: if pkg != null && lib.meta.availableOn stdenv.hostPlatform pkg then pkg else null;
21 libOnly = prefix == "lib";
23 optDbus = if stdenv.hostPlatform.isDarwin then null else shouldUsePkg dbus;
24 optPythonDBus = if libOnly then null else shouldUsePkg dbus-python;
25 optLibffado = if libOnly then null else shouldUsePkg libffado;
26 optAlsaLib = if libOnly then null else shouldUsePkg alsa-lib;
27 optLibopus = shouldUsePkg libopus;
29 stdenv.mkDerivation (finalAttrs: {
30 pname = "${prefix}jack2";
33 src = fetchFromGitHub {
36 rev = "v${finalAttrs.version}";
37 sha256 = "sha256-Cslfys5fcZDy0oee9/nM5Bd1+Cg4s/ayXjJJOSQCL4E=";
40 outputs = [ "out" "dev" ];
42 nativeBuildInputs = [ pkg-config python wafHook ]
43 ++ lib.optionals (optDbus != null) [ makeWrapper ];
44 buildInputs = [ libsamplerate libsndfile readline eigen celt
45 optDbus optPythonDBus optLibffado optAlsaLib optLibopus
46 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
47 aften AudioUnit CoreAudio Accelerate libobjc
53 name = "jack2-waf2.0.26.patch";
54 url = "https://github.com/jackaudio/jack2/commit/250420381b1a6974798939ad7104ab1a4b9a9994.patch";
55 hash = "sha256-M/H72lLTeddefqth4BSkEfySZRYMIzLErb7nIgVN0u8=";
60 patchShebangs --build svnversion_regenerate.sh
65 "--autostart=${if (optDbus != null) then "dbus" else "classic"}"
66 ] ++ lib.optional (optDbus != null) "--dbus"
67 ++ lib.optional (optLibffado != null) "--firewire"
68 ++ lib.optional (optAlsaLib != null) "--alsa";
70 postInstall = (if libOnly then ''
71 rm -rf $out/{bin,share}
72 rm -rf $out/lib/{jack,libjacknet*,libjackserver*}
73 '' else lib.optionalString (optDbus != null) ''
74 wrapProgram $out/bin/jack_control --set PYTHONPATH $PYTHONPATH
78 substituteInPlace "$dev/lib/pkgconfig/jack.pc" \
79 --replace "$out/include" "$dev/include"
82 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
85 description = "JACK audio connection kit, version 2 with jackdbus";
86 homepage = "https://jackaudio.org";
87 license = licenses.gpl2Plus;
88 pkgConfigModules = [ "jack" ];
89 platforms = platforms.unix;