Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 133 lines 3.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch2, 6 alsa-lib, 7 file, 8 fluidsynth, 9 jack2, 10 liblo, 11 libpulseaudio, 12 libsndfile, 13 pkg-config, 14 python3Packages, 15 which, 16 gtk2 ? null, 17 gtk3 ? null, 18 qtbase ? null, 19 withFrontend ? true, 20 withGtk2 ? true, 21 withGtk3 ? true, 22 withQt ? true, 23 wrapQtAppsHook ? null, 24}: 25 26assert withQt -> qtbase != null; 27assert withQt -> wrapQtAppsHook != null; 28 29stdenv.mkDerivation (finalAttrs: { 30 pname = "carla"; 31 version = "2.5.9"; 32 33 src = fetchFromGitHub { 34 owner = "falkTX"; 35 repo = "carla"; 36 rev = "v${finalAttrs.version}"; 37 hash = "sha256-FM/6TtNhDml1V9C5VisjLcZ3CzXsuwCZrsoz4yP3kI8="; 38 }; 39 40 patches = [ 41 (fetchpatch2 { 42 # https://github.com/falkTX/Carla/pull/1933 43 name = "prefer-pyliblo3-over-pyliblo.patch"; 44 url = "https://github.com/falkTX/Carla/commit/a81a2a545d2529233a6e0faa776fbd2d851442fb.patch?full_index=1"; 45 hash = "sha256-CHK3Aq/W9PdfMGsJunLN/WAxOmWJHc0jr/3TdEaIcMM="; 46 }) 47 ]; 48 49 nativeBuildInputs = [ 50 python3Packages.wrapPython 51 pkg-config 52 which 53 wrapQtAppsHook 54 ]; 55 56 pythonPath = 57 with python3Packages; 58 [ 59 rdflib 60 pyliblo3 61 ] 62 ++ lib.optional withFrontend pyqt5; 63 64 buildInputs = [ 65 file 66 liblo 67 alsa-lib 68 fluidsynth 69 jack2 70 libpulseaudio 71 libsndfile 72 ] 73 ++ lib.optional withQt qtbase 74 ++ lib.optional withGtk2 gtk2 75 ++ lib.optional withGtk3 gtk3; 76 77 propagatedBuildInputs = finalAttrs.pythonPath; 78 79 enableParallelBuilding = true; 80 81 installFlags = [ "PREFIX=$(out)" ]; 82 83 postPatch = '' 84 # --with-appname="$0" is evaluated with $0=.carla-wrapped instead of carla. Fix that. 85 for file in $(grep -rl -- '--with-appname="$0"'); do 86 filename="$(basename -- "$file")" 87 substituteInPlace "$file" --replace '--with-appname="$0"' "--with-appname=\"$filename\"" 88 done 89 '' 90 + lib.optionalString withGtk2 '' 91 # Will try to dlopen() libgtk-x11-2.0 at runtime when using the bridge. 92 substituteInPlace source/bridges-ui/Makefile \ 93 --replace '$(CXX) $(OBJS_GTK2)' '$(CXX) $(OBJS_GTK2) -lgtk-x11-2.0' 94 ''; 95 96 dontWrapQtApps = true; 97 postFixup = '' 98 # Also sets program_PYTHONPATH and program_PATH variables 99 wrapPythonPrograms 100 wrapPythonProgramsIn "$out/share/carla/resources" "$out $pythonPath" 101 102 find "$out/share/carla" -maxdepth 1 -type f -not -name "*.py" -print0 | while read -d "" f; do 103 patchPythonScript "$f" 104 done 105 patchPythonScript "$out/share/carla/carla_settings.py" 106 107 for program in $out/bin/*; do 108 wrapQtApp "$program" \ 109 --prefix PATH : "$program_PATH:${which}/bin" \ 110 --set PYTHONNOUSERSITE true 111 done 112 113 find "$out/share/carla/resources" -maxdepth 1 -type f -not -name "*.py" -print0 | while read -d "" f; do 114 wrapQtApp "$f" \ 115 --prefix PATH : "$program_PATH:${which}/bin" \ 116 --set PYTHONNOUSERSITE true 117 done 118 ''; 119 120 meta = with lib; { 121 homepage = "https://kx.studio/Applications:Carla"; 122 description = "Audio plugin host"; 123 longDescription = '' 124 It currently supports LADSPA (including LRDF), DSSI, LV2, VST2/3 125 and AU plugin formats, plus GIG, SF2 and SFZ file support. 126 It uses JACK as the default and preferred audio driver but also 127 supports native drivers like ALSA, DirectSound or CoreAudio. 128 ''; 129 license = licenses.gpl2Plus; 130 maintainers = [ maintainers.minijackson ]; 131 platforms = platforms.linux; 132 }; 133})