18 , jackSupport ? stdenv.hostPlatform.isLinux
20 , pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux
25 url_for_platform = version: arch: if stdenv.hostPlatform.isDarwin
26 then "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${builtins.replaceStrings ["."] [""] version}_universal.dmg"
27 else "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${builtins.replaceStrings ["."] [""] version}_linux_${arch}.tar.xz";
29 stdenv.mkDerivation rec {
34 url = url_for_platform version stdenv.hostPlatform.qemuArch;
35 hash = if stdenv.hostPlatform.isDarwin then "sha256-jDqdtm0W5mF8U/KJi7vRse9tT2X4AVwHUtvXC+6iADM=" else {
36 x86_64-linux = "sha256-/szRnFsu0LpthdMOy/6fmkE72zxBvhQkcVhPtO54Djk=";
37 aarch64-linux = "sha256-yl5PCRSzRiZ5TF9gXoP572H19/vlszJeFARtZy5ClXI=";
38 }.${stdenv.hostPlatform.system};
43 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
46 xdg-utils # Required for desktop integration
47 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
51 sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin "Reaper.app";
54 (lib.getLib stdenv.cc.cc) # reaper and libSwell need libstdc++.so.6
55 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
60 runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux [
61 gtk3 # libSwell needs libgdk-3.so.0
63 ++ lib.optional jackSupport jackLibrary
64 ++ lib.optional pulseaudioSupport libpulseaudio;
68 installPhase = if stdenv.hostPlatform.isDarwin then ''
70 mkdir -p "$out/Applications/Reaper.app"
71 cp -r * "$out/Applications/Reaper.app/"
72 makeWrapper "$out/Applications/Reaper.app/Contents/MacOS/REAPER" "$out/bin/reaper"
77 HOME="$out/share" XDG_DATA_HOME="$out/share" ./install-reaper.sh \
79 --integrate-user-desktop
80 rm $out/opt/REAPER/uninstall-reaper.sh
82 # Dynamic loading of plugin dependencies does not adhere to rpath of
83 # reaper executable that gets modified with runtimeDependencies.
84 # Patching each plugin with DT_NEEDED is cumbersome and requires
85 # hardcoding of API versions of each dependency.
86 # Setting the rpath of the plugin shared object files does not
87 # seem to have an effect for some plugins.
88 # We opt for wrapping the executable with LD_LIBRARY_PATH prefix.
89 # Note that libcurl and libxml2 are needed for ReaPack to run.
90 wrapProgram $out/opt/REAPER/reaper \
91 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ curl lame libxml2 ffmpeg vlc xdotool stdenv.cc.cc ]}"
94 ln -s $out/opt/REAPER/reaper $out/bin/
99 passthru.updateScript = ./updater.sh;
102 description = "Digital audio workstation";
103 homepage = "https://www.reaper.fm/";
104 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
105 license = licenses.unfree;
106 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
107 maintainers = with maintainers; [ ilian orivej uniquepointer viraptor ];