diff --git a/modules/linux/audio-prod/default.nix b/modules/linux/audio-prod/default.nix index 3802bf2..d82f1b9 100644 --- a/modules/linux/audio-prod/default.nix +++ b/modules/linux/audio-prod/default.nix @@ -35,9 +35,50 @@ in yabridgectl alsa-scarlett-gui ]) - ++ (lib.optionals config.liminalOS.config.allowUnfree [ - pkgs.reaper - ]) + ++ (lib.optionals config.liminalOS.config.allowUnfree ( + with pkgs; + [ + (reaper.overrideAttrs ( + finalAttrs: prevAttrs: { + installPhase = '' + runHook preInstall + + HOME="$out/share" XDG_DATA_HOME="$out/share" ./install-reaper.sh \ + --install $out/opt \ + --integrate-user-desktop + rm $out/opt/REAPER/uninstall-reaper.sh + + # Dynamic loading of plugin dependencies does not adhere to rpath of + # reaper executable that gets modified with runtimeDependencies. + # Patching each plugin with DT_NEEDED is cumbersome and requires + # hardcoding of API versions of each dependency. + # Setting the rpath of the plugin shared object files does not + # seem to have an effect for some plugins. + # We opt for wrapping the executable with LD_LIBRARY_PATH prefix. + # Note that libcurl and libxml2 are needed for ReaPack to run. + wrapProgram $out/opt/REAPER/reaper \ + --prefix LD_LIBRARY_PATH : "${ + lib.makeLibraryPath [ + curl + lame + libxml2 + ffmpeg + vlc + xdotool + stdenv.cc.cc + ] + }" \ + --prefix PIPEWIRE_LATENCY : "128/48000" + + mkdir $out/bin + ln -s $out/opt/REAPER/reaper $out/bin/ + + runHook postInstall + ''; + } + )) + ] + )) ); musnix.enable = cfg.enable;