13 # Required dependencies
19 # Optional dependencies
20 alsaSupport ? stdenv.hostPlatform.isLinux,
30 portaudioSupport ? true,
32 sndioSupport ? stdenv.hostPlatform.isOpenBSD,
35 # Optional GUI dependencies
50 assert builtins.any (g: guiModule == g) [
62 "zest" = "Zyn-Fusion";
66 mruby-zest = callPackage ./mruby-zest { };
68 stdenv.mkDerivation rec {
69 pname = "zynaddsubfx";
72 src = fetchFromGitHub {
75 rev = "refs/tags/${version}";
76 fetchSubmodules = true;
77 hash = "sha256-0siAx141DZx39facXWmKbsi0rHBNpobApTdey07EcXg=";
86 # Lazily expand ZYN_DATADIR to fix builtin banks across updates
88 url = "https://github.com/zynaddsubfx/zynaddsubfx/commit/853aa03f4f92a180b870fa62a04685d12fca55a7.patch";
89 hash = "sha256-4BsRZ9keeqKopr6lCQJznaZ3qWuMgD1/mCrdMiskusg=";
94 patchShebangs rtosc/test/test-port-checker.rb src/Tests/check-ports.rb
110 ++ lib.optionals alsaSupport [ alsa-lib ]
111 ++ lib.optionals dssiSupport [
115 ++ lib.optionals jackSupport [ libjack2 ]
116 ++ lib.optionals lashSupport [ lash ]
117 ++ lib.optionals portaudioSupport [ portaudio ]
118 ++ lib.optionals sndioSupport [ sndio ]
119 ++ lib.optionals (guiModule == "fltk") [
124 ++ lib.optionals (guiModule == "ntk") [
129 ++ lib.optionals (guiModule == "zest") [
136 "-DGuiModule=${guiModule}"
137 "-DZYN_DATADIR=${placeholder "out"}/share/zynaddsubfx"
139 # OSS library is included in glibc.
140 # Must explicitly disable if support is not wanted.
141 ++ lib.optional (!ossSupport) "-DOssEnable=OFF"
142 # Find FLTK without requiring an OpenGL library in buildInputs
143 ++ lib.optional (guiModule == "fltk") "-DFLTK_SKIP_OPENGL=ON";
146 # GCC 13: error: 'uint8_t' does not name a type
151 nativeCheckInputs = [
156 # TODO: Update cmake hook to make it simpler to selectively disable cmake tests: #113829
160 # PortChecker is non-deterministic. It's fixed in the master
161 # branch, but backporting would require an update to rtosc, so
162 # we'll just disable it until the next release.
165 # Tests fail on aarch64
166 ++ lib.optionals stdenv.hostPlatform.isAarch64 [
173 ctest --output-on-failure -E '^${lib.concatStringsSep "|" disabledTests}$'
177 # Use Zyn-Fusion logo for zest build
178 # An SVG version of the logo isn't hosted anywhere we can fetch, I
179 # had to manually derive it from the code that draws it in-app:
180 # https://github.com/mruby-zest/mruby-zest-build/blob/3.0.6/src/mruby-zest/example/ZynLogo.qml#L65-L97
181 postInstall = lib.optionalString (guiModule == "zest") ''
182 rm -r "$out/share/pixmaps"
183 mkdir -p "$out/share/icons/hicolor/scalable/apps"
184 cp ${./ZynLogo.svg} "$out/share/icons/hicolor/scalable/apps/zynaddsubfx.svg"
187 # When building with zest GUI, patch plugins
188 # and standalone executable to properly locate zest
189 postFixup = lib.optionalString (guiModule == "zest") ''
190 for lib in "$out/lib/lv2/ZynAddSubFX.lv2/ZynAddSubFX_ui.so" "$out/lib/vst/ZynAddSubFX.so"; do
191 patchelf --set-rpath "${mruby-zest}:$(patchelf --print-rpath "$lib")" "$lib"
194 wrapProgram "$out/bin/zynaddsubfx" \
195 --prefix PATH : ${mruby-zest} \
196 --prefix LD_LIBRARY_PATH : ${mruby-zest}
200 description = "High quality software synthesizer (${guiName} GUI)";
201 mainProgram = "zynaddsubfx";
203 if guiModule == "zest" then
204 "https://zynaddsubfx.sourceforge.io/zyn-fusion.html"
206 "https://zynaddsubfx.sourceforge.io";
208 license = licenses.gpl2Plus;
209 maintainers = with maintainers; [ kira-bruneau ];
210 platforms = platforms.all;
213 # - Tests don't compile (ld: unknown option: --no-as-needed)
214 # - ZynAddSubFX LV2 & VST plugin fail to compile (not setup to use ObjC version of pugl)
215 # - TTL generation crashes (`pointer being freed was not allocated`) for all VST plugins using AbstractFX
216 # - Zest UI fails to start on pulg_setup: Could not open display, aborting.
217 broken = stdenv.hostPlatform.isDarwin;