Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 154 lines 4.0 kB view raw
1{ 2 config, 3 lib, 4 stdenv, 5 fetchurl, 6 autoPatchelfHook, 7 makeWrapper, 8 undmg, 9 10 alsa-lib, 11 curl, 12 gtk3, 13 lame, 14 libxml2, 15 ffmpeg, 16 vlc, 17 xdg-utils, 18 xdotool, 19 which, 20 21 jackSupport ? stdenv.hostPlatform.isLinux, 22 jackLibrary, 23 pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux, 24 libpulseaudio, 25}: 26 27let 28 url_for_platform = 29 version: arch: 30 if stdenv.hostPlatform.isDarwin then 31 "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${ 32 builtins.replaceStrings [ "." ] [ "" ] version 33 }_universal.dmg" 34 else 35 "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${ 36 builtins.replaceStrings [ "." ] [ "" ] version 37 }_linux_${arch}.tar.xz"; 38in 39stdenv.mkDerivation rec { 40 pname = "reaper"; 41 version = "7.42"; 42 43 src = fetchurl { 44 url = url_for_platform version stdenv.hostPlatform.qemuArch; 45 hash = 46 if stdenv.hostPlatform.isDarwin then 47 "sha256-3K2cgOwBRwm/S4MRcymKCxRhUMkcfuWzWn1G2m3Dbf4=" 48 else 49 { 50 x86_64-linux = "sha256-XxVcy3s3gOnh6uhv9r0yJFwBMCxhrnT/swaUY4t1CpY="; 51 aarch64-linux = "sha256-3DKVyooYi6aSBzP4DSnIchGyHKbCANjX0TPspKf5dXU="; 52 } 53 .${stdenv.hostPlatform.system}; 54 }; 55 56 nativeBuildInputs = [ 57 makeWrapper 58 ] 59 ++ lib.optionals stdenv.hostPlatform.isLinux [ 60 which 61 autoPatchelfHook 62 xdg-utils # Required for desktop integration 63 ] 64 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 65 undmg 66 ]; 67 68 sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin "Reaper.app"; 69 70 buildInputs = [ 71 (lib.getLib stdenv.cc.cc) # reaper and libSwell need libstdc++.so.6 72 ] 73 ++ lib.optionals stdenv.hostPlatform.isLinux [ 74 gtk3 75 alsa-lib 76 ]; 77 78 runtimeDependencies = 79 lib.optionals stdenv.hostPlatform.isLinux [ 80 gtk3 # libSwell needs libgdk-3.so.0 81 ] 82 ++ lib.optional jackSupport jackLibrary 83 ++ lib.optional pulseaudioSupport libpulseaudio; 84 85 dontBuild = true; 86 dontStrip = true; 87 88 installPhase = 89 if stdenv.hostPlatform.isDarwin then 90 '' 91 runHook preInstall 92 mkdir -p "$out/Applications/Reaper.app" 93 cp -r * "$out/Applications/Reaper.app/" 94 makeWrapper "$out/Applications/Reaper.app/Contents/MacOS/REAPER" "$out/bin/reaper" 95 runHook postInstall 96 '' 97 else 98 '' 99 runHook preInstall 100 101 HOME="$out/share" XDG_DATA_HOME="$out/share" ./install-reaper.sh \ 102 --install $out/opt \ 103 --integrate-user-desktop 104 rm $out/opt/REAPER/uninstall-reaper.sh 105 106 # Dynamic loading of plugin dependencies does not adhere to rpath of 107 # reaper executable that gets modified with runtimeDependencies. 108 # Patching each plugin with DT_NEEDED is cumbersome and requires 109 # hardcoding of API versions of each dependency. 110 # Setting the rpath of the plugin shared object files does not 111 # seem to have an effect for some plugins. 112 # We opt for wrapping the executable with LD_LIBRARY_PATH prefix. 113 # Note that libcurl and libxml2 are needed for ReaPack to run. 114 wrapProgram $out/opt/REAPER/reaper \ 115 --prefix LD_LIBRARY_PATH : "${ 116 lib.makeLibraryPath [ 117 curl 118 lame 119 libxml2 120 ffmpeg 121 vlc 122 xdotool 123 stdenv.cc.cc 124 ] 125 }" 126 127 mkdir $out/bin 128 ln -s $out/opt/REAPER/reaper $out/bin/ 129 130 runHook postInstall 131 ''; 132 133 passthru.updateScript = ./updater.sh; 134 135 meta = with lib; { 136 description = "Digital audio workstation"; 137 homepage = "https://www.reaper.fm/"; 138 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 139 license = licenses.unfree; 140 platforms = [ 141 "x86_64-linux" 142 "aarch64-linux" 143 "x86_64-darwin" 144 "aarch64-darwin" 145 ]; 146 maintainers = with maintainers; [ 147 atinba 148 ilian 149 orivej 150 uniquepointer 151 viraptor 152 ]; 153 }; 154}