push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,264 @@
{
stdenv,
lib,
fetchFromGitHub,
wrapQtAppsHook,
makeDesktopItem,
copyDesktopItems,
cmake,
pkg-config,
catch2_3,
qtbase,
qtsvg,
qttools,
qtwayland,
qwt,
qscintilla,
kissfftFloat,
crossguid,
reproc,
platform-folders,
ruby_3_2,
beamPackages,
alsa-lib,
rtmidi,
boost,
aubio,
jack2,
jack-example-tools,
pipewire,
supercollider-with-sc3-plugins,
parallel,
withTauWidget ? false,
qtwebengine,
withImGui ? false,
gl3w,
SDL2,
fmt,
}:
# Sonic Pi fails to build with Ruby 3.3.
let
ruby = ruby_3_2;
in
stdenv.mkDerivation rec {
pname = "sonic-pi";
version = "4.5.1";
src = fetchFromGitHub {
owner = "sonic-pi-net";
repo = "sonic-pi";
rev = "v${version}";
hash = "sha256-JMextQY0jLShWmqRQoVAbqIzDhA1mOzI7vfsG7+jjX0=";
};
mixFodDeps = beamPackages.fetchMixDeps {
inherit version;
pname = "mix-deps-sonic-pi";
mixEnv = "test";
src = "${src}/app/server/beam/tau";
hash = "sha256-7wqFI3f0CRVrXK2IUguqHNANwKMmTak/Xh9nr624TXc=";
};
strictDeps = true;
nativeBuildInputs = [
wrapQtAppsHook
copyDesktopItems
cmake
pkg-config
ruby
beamPackages.erlang
beamPackages.elixir
beamPackages.hex
];
buildInputs = [
qtbase
qtsvg
qttools
qtwayland
qwt
qscintilla
kissfftFloat
catch2_3
crossguid
reproc
platform-folders
ruby
alsa-lib
rtmidi
boost
aubio
]
++ lib.optionals withTauWidget [
qtwebengine
]
++ lib.optionals withImGui [
gl3w
SDL2
fmt
];
nativeCheckInputs = [
parallel
supercollider-with-sc3-plugins
jack2
];
cmakeFlags = [
"-DUSE_SYSTEM_LIBS=ON"
"-DBUILD_IMGUI_INTERFACE=${if withImGui then "ON" else "OFF"}"
"-DWITH_QT_GUI_WEBENGINE=${if withTauWidget then "ON" else "OFF"}"
"-DAPP_INSTALL_ROOT=${placeholder "out"}/app"
];
doCheck = true;
postPatch = ''
# Fix shebangs on files in app and bin scripts
patchShebangs app bin
'';
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
# Copy Mix dependency sources
echo 'Copying ${mixFodDeps} to Mix deps'
cp --no-preserve=mode -R '${mixFodDeps}' "$MIX_DEPS_PATH"
# Change to project base directory
cd app
# Prebuild Ruby vendored dependencies and Qt docs
./linux-prebuild.sh -o
'';
postBuild = ''
# Build BEAM server
../linux-post-tau-prod-release.sh -o
'';
checkPhase = ''
runHook preCheck
# BEAM tests
pushd ../server/beam/tau
MIX_ENV=test TAU_ENV=test mix test
popd
# Ruby tests
pushd ../server/ruby
rake test
popd
# API tests
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'
popd
runHook postCheck
'';
installPhase = ''
runHook preInstall
# Run Linux release script
../linux-release.sh
# 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
runHook postInstall
'';
# $out/bin/sonic-pi is a shell script, and wrapQtAppsHook doesn't wrap them.
dontWrapQtApps = true;
preFixup = ''
# Wrap Qt GUI (distributed binary)
wrapQtApp $out/bin/sonic-pi \
--prefix PATH : ${
lib.makeBinPath [
ruby
supercollider-with-sc3-plugins
jack2
jack-example-tools
pipewire.jack
]
}
# If ImGui was built
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 : ${
lib.makeBinPath [
ruby
supercollider-with-sc3-plugins
jack2
jack-example-tools
pipewire.jack
]
}
fi
# 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
done
'';
stripDebugList = [
"app"
"bin"
];
desktopItems = [
(makeDesktopItem {
name = "sonic-pi";
exec = "sonic-pi";
icon = "sonic-pi";
desktopName = "Sonic Pi";
comment = meta.description;
categories = [
"Audio"
"AudioVideo"
"Education"
];
})
];
passthru.updateScript = ./update.sh;
meta = with lib; {
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; [
Phlogistique
kamilchm
c0deaddict
sohalt
];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,50 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix jq common-updater-scripts
set -euo pipefail
nixpkgs="$(git rev-parse --show-toplevel || (printf 'Could not find root of nixpkgs repo\nAre we running from within the nixpkgs git repo?\n' >&2; exit 1))"
stripwhitespace() {
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
}
nixeval() {
nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1" | jq -r .
}
vendorhash() {
(nix --extra-experimental-features nix-command build --impure --argstr nixpkgs "$nixpkgs" --argstr attr "$1" --expr '{ nixpkgs, attr }: let pkgs = import nixpkgs {}; in with pkgs.lib; (getAttrFromPath (splitString "." attr) pkgs).overrideAttrs (attrs: { outputHash = fakeHash; })' --no-link 2>&1 >/dev/null | tail -n3 | grep -F got: | cut -d: -f2- | stripwhitespace) 2>/dev/null || true
}
findpath() {
path="$(nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1.meta.position" | jq -r . | cut -d: -f1)"
outpath="$(nix --extra-experimental-features nix-command eval --json --impure --expr "fetchGit \"$nixpkgs\"")"
if [ -n "$outpath" ]; then
path="${path/$(echo "$outpath" | jq -r .)/$nixpkgs}"
fi
echo "$path"
}
attr="${UPDATE_NIX_ATTR_PATH:-sonic-pi}"
version="$(cd "$nixpkgs" && list-git-tags --pname="$(nixeval "$attr".pname)" --attr-path="$attr" | grep '^v' | sed -e 's|^v||' | sort -V | tail -n1)"
pkgpath="$(findpath "$attr")"
updated="$(cd "$nixpkgs" && update-source-version "$attr" "$version" --file="$pkgpath" --print-changes | jq -r length)"
if [ "$updated" -eq 0 ]; then
echo 'update.sh: Package version not updated, nothing to do.'
exit 0
fi
curhash="$(nixeval "$attr.mixFodDeps.outputHash")"
newhash="$(vendorhash "$attr.mixFodDeps")"
if [ -n "$newhash" ] && [ "$curhash" != "$newhash" ]; then
sed -i -e "s|\"$curhash\"|\"$newhash\"|" "$pkgpath"
else
echo 'update.sh: New vendorHash same as old vendorHash, nothing to do.'
fi