2020-04-24 23:36:52 +00:00
|
|
|
{ mkDerivation
|
|
|
|
, lib
|
|
|
|
, qtbase
|
|
|
|
, fetchFromGitHub
|
|
|
|
, ruby
|
2022-03-30 09:31:56 +00:00
|
|
|
, erlang
|
2020-04-24 23:36:52 +00:00
|
|
|
, aubio
|
2022-03-30 09:31:56 +00:00
|
|
|
, alsa-lib
|
|
|
|
, rtmidi
|
|
|
|
, libsndfile
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, boost
|
|
|
|
, bash
|
2021-04-05 15:23:46 +00:00
|
|
|
, jack2
|
2022-07-14 12:49:19 +00:00
|
|
|
, supercollider-with-sc3-plugins
|
2020-04-24 23:36:52 +00:00
|
|
|
, qwt
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "sonic-pi";
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "3.3.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
2022-03-30 09:31:56 +00:00
|
|
|
owner = "sonic-pi-net";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "sonic-pi";
|
|
|
|
rev = "v${version}";
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "sha256-AE7iuSNnW1SAtBMplReGzXKcqD4GG23i10MIAWnlcPo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
# sonic pi uses it's own aubioonset with hardcoded parameters but will compile a whole aubio for it
|
|
|
|
# let's just build the aubioonset instead and link against aubio from nixpkgs
|
|
|
|
aubioonset = mkDerivation {
|
|
|
|
name = "aubioonset";
|
|
|
|
src = src;
|
|
|
|
sourceRoot = "source/app/external/aubio/examples";
|
|
|
|
buildInputs = [jack2 aubio libsndfile];
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i "s@<aubio.h>@<aubio/aubio.h>@" jackio.c utils.h
|
|
|
|
'';
|
|
|
|
buildPhase = ''
|
|
|
|
gcc -o aubioonset -laubio jackio.c utils.c aubioonset.c
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
install -D aubioonset $out/aubioonset
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
mkDerivation rec {
|
|
|
|
inherit pname version src;
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
|
|
|
bash
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
qtbase
|
|
|
|
qwt
|
|
|
|
ruby
|
|
|
|
aubio
|
2022-07-14 12:49:19 +00:00
|
|
|
supercollider-with-sc3-plugins
|
2020-04-24 23:36:52 +00:00
|
|
|
boost
|
2022-03-30 09:31:56 +00:00
|
|
|
erlang
|
|
|
|
alsa-lib
|
|
|
|
rtmidi
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
prePatch = ''
|
|
|
|
sed -i '/aubio/d' app/external/linux_build_externals.sh
|
|
|
|
sed -i '/aubio/d' app/linux-prebuild.sh
|
|
|
|
patchShebangs app
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
./app/linux-prebuild.sh
|
|
|
|
./app/linux-config.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
runHook postConfigure
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
pushd app/build
|
|
|
|
cmake --build . --config Release
|
2020-04-24 23:36:52 +00:00
|
|
|
popd
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2020-06-18 07:06:33 +00:00
|
|
|
|
|
|
|
mkdir $out
|
|
|
|
cp -r {bin,etc} $out/
|
|
|
|
|
|
|
|
# Copy server whole.
|
|
|
|
mkdir -p $out/app
|
|
|
|
cp -r app/server $out/app/
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
# We didn't build this during linux-prebuild.sh so copy from the separate derivation
|
|
|
|
cp ${aubioonset}/aubioonset $out/app/server/native/
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
# Copy only necessary files for the gui app.
|
2022-03-30 09:31:56 +00:00
|
|
|
mkdir -p $out/app/gui/qt
|
2020-06-18 07:06:33 +00:00
|
|
|
cp -r app/gui/qt/{book,fonts,help,html,images,image_source,info,lang,theme} $out/app/gui/qt/
|
2022-03-30 09:31:56 +00:00
|
|
|
mkdir -p $out/app/build/gui/qt
|
|
|
|
cp app/build/gui/qt/sonic-pi $out/app/build/gui/qt/sonic-pi
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
# $out/bin/sonic-pi is a shell script, and wrapQtAppsHook doesn't wrap them.
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
preFixup = ''
|
|
|
|
wrapQtApp "$out/bin/sonic-pi" \
|
2022-07-14 12:49:19 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ bash jack2 ruby supercollider-with-sc3-plugins erlang] }
|
2021-09-18 10:52:07 +00:00
|
|
|
makeWrapper \
|
|
|
|
$out/app/server/ruby/bin/sonic-pi-server.rb \
|
|
|
|
$out/bin/sonic-pi-server \
|
2022-07-14 12:49:19 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ bash jack2 ruby supercollider-with-sc3-plugins erlang ] }
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://sonic-pi.net/";
|
|
|
|
description = "Free live coding synth for everyone originally designed to support computing and music lessons within schools";
|
|
|
|
license = lib.licenses.mit;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with lib.maintainers; [ Phlogistique kamilchm c0deaddict sohalt lilyinstarlight ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|