@@ -0,0 +1,71 @@
1+{ stdenv, fetchFromGitHub, alsaLib, file, fluidsynth, ffmpeg, fftw, jack2,
2+ liblo, libpulseaudio, libsndfile, makeWrapper, pkgconfig, python3Packages,
3+ which, withFrontend ? true,
4+ withQt ? true, qtbase ? null,
5+ withGtk2 ? true, gtk2 ? null,
6+ withGtk3 ? true, gtk3 ? null }:
7+
8+with stdenv.lib;
9+
10+assert withFrontend -> python3Packages ? pyqt5;
11+assert withQt -> qtbase != null;
12+assert withGtk2 -> gtk2 != null;
13+assert withGtk3 -> gtk3 != null;
14+
15+stdenv.mkDerivation rec {
16+ pname = "carla";
17+ version = "2.0.0";
18+
19+ src = fetchFromGitHub {
20+ owner = "falkTX";
21+ repo = pname;
22+ rev = "v${version}";
23+ sha256 = "0fqgncqlr86n38yy7pa118mswfacmfczj7w9xx6c6k0jav3wk29k";
24+ };
25+
26+ nativeBuildInputs = [ python3Packages.wrapPython pkgconfig which ];
27+
28+ pythonPath = with python3Packages; [
29+ rdflib pyliblo
30+ ] ++ optional withFrontend pyqt5;
31+
32+ buildInputs = [
33+ file liblo alsaLib fluidsynth ffmpeg jack2 libpulseaudio libsndfile
34+ ] ++ pythonPath
35+ ++ optional withQt qtbase
36+ ++ optional withGtk2 gtk2
37+ ++ optional withGtk3 gtk3;
38+
39+ installFlags = [ "PREFIX=$(out)" ];
40+
41+ postFixup = ''
42+ # Also sets program_PYTHONPATH and program_PATH variables
43+ wrapPythonPrograms
44+
45+ find "$out/share/carla" -maxdepth 1 -type f -not -name "*.py" -print0 | while read -d "" f; do
46+ patchPythonScript "$f"
47+ done
48+ patchPythonScript "$out/share/carla/carla_settings.py"
49+
50+ for program in $out/bin/*; do
51+ wrapProgram "$program" \
52+ --prefix PATH : "$program_PATH:${which}/bin" \
53+ --set PYTHONNOUSERSITE true \
54+ --prefix QT_PLUGIN_PATH : "${qtbase.bin}/${qtbase.qtPluginPrefix}"
55+ done
56+ '';
57+
58+ meta = with stdenv.lib; {
59+ homepage = http://kxstudio.sf.net/carla;
60+ description = "An audio plugin host";
61+ longDescription = ''
62+ It currently supports LADSPA (including LRDF), DSSI, LV2, VST2/3
63+ and AU plugin formats, plus GIG, SF2 and SFZ file support.
64+ It uses JACK as the default and preferred audio driver but also
65+ supports native drivers like ALSA, DirectSound or CoreAudio.
66+ '';
67+ license = licenses.gpl2Plus;
68+ maintainers = [ maintainers.minijackson ];
69+ platforms = platforms.linux;
70+ };
71+}