31 supercollider-with-sc3-plugins,
34 withTauWidget ? false,
43 stdenv.mkDerivation rec {
47 src = fetchFromGitHub {
48 owner = "sonic-pi-net";
51 hash = "sha256-JMextQY0jLShWmqRQoVAbqIzDhA1mOzI7vfsG7+jjX0=";
54 mixFodDeps = beamPackages.fetchMixDeps {
56 pname = "mix-deps-${pname}";
58 src = "${src}/app/server/beam/tau";
59 hash = "sha256-7wqFI3f0CRVrXK2IUguqHNANwKMmTak/Xh9nr624TXc=";
93 ++ lib.optionals withTauWidget [
96 ++ lib.optionals withImGui [
102 nativeCheckInputs = [
104 supercollider-with-sc3-plugins
109 "-DUSE_SYSTEM_LIBS=ON"
110 "-DBUILD_IMGUI_INTERFACE=${if withImGui then "ON" else "OFF"}"
111 "-DWITH_QT_GUI_WEBENGINE=${if withTauWidget then "ON" else "OFF"}"
112 "-DAPP_INSTALL_ROOT=${placeholder "out"}/app"
118 # Fix shebangs on files in app and bin scripts
119 patchShebangs app bin
123 # Set build environment
124 export SONIC_PI_HOME="$TMPDIR/spi"
126 export HEX_HOME="$TEMPDIR/hex"
128 export MIX_REBAR3='${beamPackages.rebar3}/bin/rebar3'
129 export REBAR_GLOBAL_CONFIG_DIR="$TEMPDIR/rebar3"
130 export REBAR_CACHE_DIR="$TEMPDIR/rebar3.cache"
131 export MIX_HOME="$TEMPDIR/mix"
132 export MIX_DEPS_PATH="$TEMPDIR/deps"
135 # Copy Mix dependency sources
136 echo 'Copying ${mixFodDeps} to Mix deps'
137 cp --no-preserve=mode -R '${mixFodDeps}' "$MIX_DEPS_PATH"
139 # Change to project base directory
142 # Prebuild Ruby vendored dependencies and Qt docs
143 ./linux-prebuild.sh -o
148 ../linux-post-tau-prod-release.sh -o
155 pushd ../server/beam/tau
156 MIX_ENV=test TAU_ENV=test mix test
166 # run JACK parallel to tests and quit both when one exits
167 SONIC_PI_ENV=test parallel --no-notice -j2 --halt now,done=1 ::: 'jackd -rd dummy' 'ctest --verbose'
176 # Run Linux release script
179 # Copy dist directory to output
181 cp -r linux_dist/* $out/
184 install -Dm644 ../gui/qt/images/icon-smaller.png $out/share/icons/hicolor/256x256/apps/sonic-pi.png
189 # $out/bin/sonic-pi is a shell script, and wrapQtAppsHook doesn't wrap them.
190 dontWrapQtApps = true;
192 # Wrap Qt GUI (distributed binary)
193 wrapQtApp $out/bin/sonic-pi \
197 supercollider-with-sc3-plugins
205 if [ -e $out/app/build/gui/imgui/sonic-pi-imgui ]; then
206 # Wrap ImGui into bin
207 makeWrapper $out/app/build/gui/imgui/sonic-pi-imgui $out/bin/sonic-pi-imgui \
212 supercollider-with-sc3-plugins
220 # Remove runtime Erlang references
221 for file in $(grep -FrIl '${erlang}/lib/erlang' $out/app/server/beam/tau); do
222 substituteInPlace "$file" --replace '${erlang}/lib/erlang' $out/app/server/beam/tau/_build/prod/rel/tau
236 desktopName = "Sonic Pi";
237 comment = meta.description;
246 passthru.updateScript = ./update.sh;
249 homepage = "https://sonic-pi.net/";
250 description = "Free live coding synth for everyone originally designed to support computing and music lessons within schools";
251 license = licenses.mit;
252 maintainers = with maintainers; [
258 platforms = platforms.linux;