From bd8d15e1cd5f92a62222d2291bbc4db5f70f29c5 Mon Sep 17 00:00:00 2001 From: kyehn Date: Fri, 26 Sep 2025 06:12:17 +0800 Subject: [PATCH] sonic-pi: 4.5.1 -> 4.6.0 --- pkgs/applications/audio/sonic-pi/default.nix | 156 ++++++++++--------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 83 insertions(+), 75 deletions(-) diff --git a/pkgs/applications/audio/sonic-pi/default.nix b/pkgs/applications/audio/sonic-pi/default.nix index 11cedbaa1368..ecaf08b0c11e 100644 --- a/pkgs/applications/audio/sonic-pi/default.nix +++ b/pkgs/applications/audio/sonic-pi/default.nix @@ -1,19 +1,14 @@ { - stdenv, lib, + stdenv, fetchFromGitHub, - wrapQtAppsHook, + autoPatchelfHook, makeDesktopItem, copyDesktopItems, cmake, pkg-config, catch2_3, - qtbase, - qtsvg, - qttools, - qtwayland, - qwt, - qscintilla, + kdePackages, kissfftFloat, crossguid, reproc, @@ -31,7 +26,6 @@ parallel, withTauWidget ? false, - qtwebengine, withImGui ? false, gl3w, @@ -44,29 +38,30 @@ let ruby = ruby_3_2; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "sonic-pi"; - version = "4.5.1"; + version = "4.6.0"; src = fetchFromGitHub { owner = "sonic-pi-net"; repo = "sonic-pi"; - rev = "v${version}"; - hash = "sha256-JMextQY0jLShWmqRQoVAbqIzDhA1mOzI7vfsG7+jjX0="; + tag = "v${finalAttrs.version}"; + hash = "sha256-sF/ksVhUzSV5P3Oe/T8hAiFMFiuOMEPmuBlUZtPSvtk="; }; mixFodDeps = beamPackages.fetchMixDeps { - inherit version; + inherit (finalAttrs) version; pname = "mix-deps-sonic-pi"; mixEnv = "test"; - src = "${src}/app/server/beam/tau"; - hash = "sha256-7wqFI3f0CRVrXK2IUguqHNANwKMmTak/Xh9nr624TXc="; + src = "${finalAttrs.src}/app/server/beam/tau"; + hash = "sha256-UoETv6X/Q/RmKb0uCsu59DH7OF0H+A9e7+4uRM/B1Wk="; }; strictDeps = true; nativeBuildInputs = [ - wrapQtAppsHook + autoPatchelfHook + kdePackages.wrapQtAppsHook copyDesktopItems cmake pkg-config @@ -77,12 +72,12 @@ stdenv.mkDerivation rec { ]; buildInputs = [ - qtbase - qtsvg - qttools - qtwayland - qwt - qscintilla + kdePackages.qtbase + kdePackages.qtsvg + kdePackages.qttools + kdePackages.qtwayland + kdePackages.qwt + kdePackages.qscintilla kissfftFloat catch2_3 crossguid @@ -95,7 +90,7 @@ stdenv.mkDerivation rec { aubio ] ++ lib.optionals withTauWidget [ - qtwebengine + kdePackages.qtwebengine ] ++ lib.optionals withImGui [ gl3w @@ -118,57 +113,63 @@ stdenv.mkDerivation rec { doCheck = true; + # Fix shebangs on files in app and bin scripts postPatch = '' - # Fix shebangs on files in app and bin scripts patchShebangs app bin ''; - preConfigure = '' + preConfigure = # Set build environment - export SONIC_PI_HOME="$TMPDIR/spi" - - export HEX_HOME="$TEMPDIR/hex" - export HEX_OFFLINE=1 - export MIX_REBAR3='${beamPackages.rebar3}/bin/rebar3' - export REBAR_GLOBAL_CONFIG_DIR="$TEMPDIR/rebar3" - export REBAR_CACHE_DIR="$TEMPDIR/rebar3.cache" - export MIX_HOME="$TEMPDIR/mix" - export MIX_DEPS_PATH="$TEMPDIR/deps" - export MIX_ENV=prod + '' + export SONIC_PI_HOME="$TMPDIR/spi" + export HEX_HOME="$TEMPDIR/hex" + export HEX_OFFLINE=1 + export MIX_REBAR3='${beamPackages.rebar3}/bin/rebar3' + export REBAR_GLOBAL_CONFIG_DIR="$TEMPDIR/rebar3" + export REBAR_CACHE_DIR="$TEMPDIR/rebar3.cache" + export MIX_HOME="$TEMPDIR/mix" + export MIX_DEPS_PATH="$TEMPDIR/deps" + export MIX_ENV=prod + '' # Copy Mix dependency sources - echo 'Copying ${mixFodDeps} to Mix deps' - cp --no-preserve=mode -R '${mixFodDeps}' "$MIX_DEPS_PATH" - + + '' + echo 'Copying ${finalAttrs.mixFodDeps} to Mix deps' + cp --no-preserve=mode -R '${finalAttrs.mixFodDeps}' "$MIX_DEPS_PATH" + '' # Change to project base directory - cd app - + + '' + cd app + '' # Prebuild Ruby vendored dependencies and Qt docs - ./linux-prebuild.sh -o - ''; + + '' + ./linux-prebuild.sh -o + ''; + # Build BEAM server postBuild = '' - # Build BEAM server ../linux-post-tau-prod-release.sh -o ''; checkPhase = '' runHook preCheck - - # BEAM tests + '' + # BEAM tests + + '' pushd ../server/beam/tau - MIX_ENV=test TAU_ENV=test mix test + MIX_ENV=test TAU_ENV=test mix test popd - - # Ruby tests + '' + # Ruby tests + + '' pushd ../server/ruby - rake test + rake test popd - - # API tests + '' + # API tests, run JACK parallel to tests and quit both when one exits + + '' pushd api-tests - # run JACK parallel to tests and quit both when one exits - SONIC_PI_ENV=test parallel --no-notice -j2 --halt now,done=1 ::: 'jackd -rd dummy' 'ctest --verbose' + SONIC_PI_ENV=test parallel --no-notice -j2 --halt now,done=1 ::: 'jackd -rd dummy' 'ctest --verbose' popd runHook postCheck @@ -176,16 +177,19 @@ stdenv.mkDerivation rec { installPhase = '' runHook preInstall - - # Run Linux release script + '' + # Run Linux release script + + '' ../linux-release.sh - - # Copy dist directory to output + '' + # Copy dist directory to output + + '' mkdir $out cp -r linux_dist/* $out/ - - # Copy icon - install -Dm644 ../gui/qt/images/icon-smaller.png $out/share/icons/hicolor/256x256/apps/sonic-pi.png + '' + # Copy icon + + '' + install -D --mode=0644 ../gui/images/icon-smaller.png $out/share/icons/hicolor/256x256/apps/sonic-pi.png runHook postInstall ''; @@ -193,7 +197,10 @@ stdenv.mkDerivation rec { # $out/bin/sonic-pi is a shell script, and wrapQtAppsHook doesn't wrap them. dontWrapQtApps = true; preFixup = '' - # Wrap Qt GUI (distributed binary) + patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" $out/app/build/gui/sonic-pi + '' + # Wrap Qt GUI (distributed binary) + + '' wrapQtApp $out/bin/sonic-pi \ --prefix PATH : ${ lib.makeBinPath [ @@ -204,10 +211,10 @@ stdenv.mkDerivation rec { pipewire.jack ] } - - # If ImGui was built + '' + # If ImGui was built, Wrap ImGui into bin + + '' if [ -e $out/app/build/gui/imgui/sonic-pi-imgui ]; then - # Wrap ImGui into bin makeWrapper $out/app/build/gui/imgui/sonic-pi-imgui $out/bin/sonic-pi-imgui \ --inherit-argv0 \ --prefix PATH : ${ @@ -220,10 +227,11 @@ stdenv.mkDerivation rec { ] } fi - - # Remove runtime Erlang references + '' + # Remove runtime Erlang references + + '' for file in $(grep -FrIl '${beamPackages.erlang}/lib/erlang' $out/app/server/beam/tau); do - substituteInPlace "$file" --replace '${beamPackages.erlang}/lib/erlang' $out/app/server/beam/tau/_build/prod/rel/tau + substituteInPlace "$file" --replace-fail '${beamPackages.erlang}/lib/erlang' $out/app/server/beam/tau/_build/prod/rel/tau done ''; @@ -238,7 +246,7 @@ stdenv.mkDerivation rec { exec = "sonic-pi"; icon = "sonic-pi"; desktopName = "Sonic Pi"; - comment = meta.description; + comment = finalAttrs.meta.description; categories = [ "Audio" "AudioVideo" @@ -249,16 +257,16 @@ stdenv.mkDerivation rec { passthru.updateScript = ./update.sh; - meta = with lib; { + meta = { homepage = "https://sonic-pi.net/"; description = "Free live coding synth for everyone originally designed to support computing and music lessons within schools"; - license = licenses.mit; - maintainers = with maintainers; [ + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ Phlogistique kamilchm c0deaddict sohalt ]; - platforms = platforms.linux; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9a1c7a5c4ce0..bf4b5e58cd34 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12460,7 +12460,7 @@ with pkgs; spotify-qt = qt6Packages.callPackage ../applications/audio/spotify-qt { }; - sonic-pi = libsForQt5.callPackage ../applications/audio/sonic-pi { }; + sonic-pi = callPackage ../applications/audio/sonic-pi { }; stag = callPackage ../applications/misc/stag { curses = ncurses;