anchor.diff:  , jack2
   , supercollider
   , qwt
  -, osmid
   }:
   
   let
   
     supercollider_single_prec = supercollider.override {  fftw = fftwSinglePrec; };
   
  +  pname = "sonic-pi";
  +  version = "3.3.1";
  +  src = fetchFromGitHub {
  +    owner = "sonic-pi-net";
  +    repo = "sonic-pi";
  +    rev = "v${version}";
  +    sha256 = "sha256-AE7iuSNnW1SAtBMplReGzXKcqD4GG23i10MIAWnlcPo=";
  +  };
  +
  +  # 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 {
  -  version = "3.2.2";
  -  pname = "sonic-pi";
  -
  -  src = fetchFromGitHub {
  -    owner = "samaaron";
  -    repo = "sonic-pi";
  -    rev = "v${version}";
  -    sha256 = "1nlkpkpg9iz2hvf5pymvk6lqhpdpjbdrvr0hrnkc3ymj7llvf1cm";
  -  };
  +  inherit pname version src;
   
     buildInputs = [
       bash
  
positive.code: , fetchFromGitHub
  , fftwSinglePrec
  , ruby
  , aubio
  , cmake
  , pkg-config
  , boost
  
negative.code:     mkdir -p $out/app
      cp -r app/server $out/app/
  
      # We didn't build this during linux-prebuild.sh so copy from the separate derivation
      cp ${aubioonset}/aubioonset $out/app/server/native/
  
      # Copy only necessary files for the gui app.
      mkdir -p $out/app/gui/qt
      cp -r app/gui/qt/{book,fonts,help,html,images,image_source,info,lang,theme} $out/app/gui/qt/
      mkdir -p $out/app/build/gui/qt
      cp app/build/gui/qt/sonic-pi $out/app/build/gui/qt/sonic-pi
  
      runHook postInstall
    '';
  