nixpkgs/pkgs/applications/audio/sonic-pi/default.nix
Jonathan Ringer 9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00

117 lines
2.4 KiB
Nix

{ mkDerivation
, lib
, qtbase
, fetchFromGitHub
, fftwSinglePrec
, ruby
, aubio
, cmake
, pkg-config
, boost
, bash
, jack2Full
, supercollider
, qwt
, osmid
}:
let
supercollider_single_prec = supercollider.override { fftw = fftwSinglePrec; };
in
mkDerivation rec {
version = "3.2.2";
pname = "sonic-pi";
src = fetchFromGitHub {
owner = "samaaron";
repo = "sonic-pi";
rev = "v${version}";
sha256 = "1nlkpkpg9iz2hvf5pymvk6lqhpdpjbdrvr0hrnkc3ymj7llvf1cm";
};
buildInputs = [
bash
cmake
pkg-config
qtbase
qwt
ruby
aubio
supercollider_single_prec
boost
];
dontUseCmakeConfigure = true;
preConfigure = ''
patchShebangs .
substituteInPlace app/gui/qt/mainwindow.cpp \
--subst-var-by ruby "${ruby}/bin/ruby" \
--subst-var out
'';
buildPhase = ''
export SONIC_PI_HOME=$TMPDIR
export AUBIO_LIB=${aubio}/lib/libaubio.so
export OSMID_DIR=app/server/native/osmid
mkdir -p $OSMID_DIR
cp ${osmid}/bin/{m2o,o2m} $OSMID_DIR
pushd app/server/ruby/bin
./compile-extensions.rb
./i18n-tool.rb -t
popd
pushd app/gui/qt
cp -f utils/ruby_help.tmpl utils/ruby_help.h
../../server/ruby/bin/qt-doc.rb -o utils/ruby_help.h
lrelease lang/*.ts
mkdir build
pushd build
cmake -G "Unix Makefiles" ..
make
popd
popd
'';
installPhase = ''
runHook preInstall
mkdir $out
cp -r {bin,etc} $out/
# Copy server whole.
mkdir -p $out/app
cp -r app/server $out/app/
# Copy only necessary files for the gui app.
mkdir -p $out/app/gui/qt/build
cp -r app/gui/qt/{book,fonts,help,html,images,image_source,info,lang,theme} $out/app/gui/qt/
cp app/gui/qt/build/sonic-pi $out/app/gui/qt/build/sonic-pi
runHook postInstall
'';
# $out/bin/sonic-pi is a shell script, and wrapQtAppsHook doesn't wrap them.
dontWrapQtApps = true;
preFixup = ''
wrapQtApp "$out/bin/sonic-pi" \
--prefix PATH : ${ruby}/bin:${bash}/bin:${supercollider}/bin:${jack2Full}/bin \
--set AUBIO_LIB "${aubio}/lib/libaubio.so"
'';
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;
maintainers = with lib.maintainers; [ Phlogistique kamilchm c0deaddict ];
platforms = lib.platforms.linux;
};
}