lol

Merge pull request #266834 from viraptor/reaper-darwin

reaper: darwin platform

authored by

Weijia Wang and committed by
GitHub
c7f0bbcf 309c806b

+38 -13
+25 -10
pkgs/applications/audio/reaper/default.nix
··· 2 2 , fetchurl 3 3 , autoPatchelfHook 4 4 , makeWrapper 5 + , undmg 5 6 6 7 , alsa-lib 7 8 , curl ··· 14 15 , xdotool 15 16 , which 16 17 17 - , jackSupport ? true 18 + , jackSupport ? stdenv.isLinux 18 19 , jackLibrary 19 - , pulseaudioSupport ? config.pulseaudio or true 20 + , pulseaudioSupport ? config.pulseaudio or stdenv.isLinux 20 21 , libpulseaudio 21 22 }: 22 23 23 24 let 24 - url_for_platform = version: arch: "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${builtins.replaceStrings ["."] [""] version}_linux_${arch}.tar.xz"; 25 + url_for_platform = version: arch: if stdenv.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"; 25 28 in 26 29 stdenv.mkDerivation rec { 27 30 pname = "reaper"; ··· 29 32 30 33 src = fetchurl { 31 34 url = url_for_platform version stdenv.hostPlatform.qemuArch; 32 - hash = { 35 + hash = if stdenv.isDarwin then "sha256-jaT+3cIFVfBopgeeTkpNs9rFX50unlPJogdhkI9bsWU=" else { 33 36 x86_64-linux = "sha256-P/PnbJPr4ErDz5ho1/dLERhqkKjdetHzKpCpfVZAYb0="; 34 37 aarch64-linux = "sha256-PdnBVlHwoEEv2SPq/p5oyiOlduCEqL35gAY+QIJU1Ys="; 35 38 }.${stdenv.hostPlatform.system}; 36 39 }; 37 40 38 41 nativeBuildInputs = [ 42 + makeWrapper 43 + ] ++ lib.optionals stdenv.isLinux [ 44 + which 39 45 autoPatchelfHook 40 - makeWrapper 41 46 xdg-utils # Required for desktop integration 42 - which 47 + ] ++ lib.optionals stdenv.isDarwin [ 48 + undmg 43 49 ]; 44 50 51 + sourceRoot = lib.optionalString stdenv.isDarwin "Reaper.app"; 52 + 45 53 buildInputs = [ 46 - alsa-lib 47 54 stdenv.cc.cc.lib # reaper and libSwell need libstdc++.so.6 55 + ] ++ lib.optionals stdenv.isLinux [ 48 56 gtk3 57 + alsa-lib 49 58 ]; 50 59 51 - runtimeDependencies = [ 60 + runtimeDependencies = lib.optionals stdenv.isLinux [ 52 61 gtk3 # libSwell needs libgdk-3.so.0 53 62 ] 54 63 ++ lib.optional jackSupport jackLibrary ··· 56 65 57 66 dontBuild = true; 58 67 59 - installPhase = '' 68 + installPhase = if stdenv.isDarwin then '' 69 + runHook preInstall 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" 73 + runHook postInstall 74 + '' else '' 60 75 runHook preInstall 61 76 62 77 HOME="$out/share" XDG_DATA_HOME="$out/share" ./install-reaper.sh \ ··· 89 104 homepage = "https://www.reaper.fm/"; 90 105 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 91 106 license = licenses.unfree; 92 - platforms = [ "x86_64-linux" "aarch64-linux" ]; 107 + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; 93 108 maintainers = with maintainers; [ jfrankenau ilian orivej uniquepointer viraptor ]; 94 109 }; 95 110 }
+13 -3
pkgs/applications/audio/reaper/updater.sh
··· 5 5 6 6 reaper_ver=$(curl -Ls https://www.reaper.fm/download.php | grep -o 'Version [0-9]\.[0-9]*' | head -n1 | cut -d' ' -f2) 7 7 8 - function set_hash_for_arch() { 8 + function set_hash_for_linux() { 9 9 local arch=$1 10 10 pkg_hash=$(nix-prefetch-url https://www.reaper.fm/files/${reaper_ver%.*}.x/reaper${reaper_ver/./}_linux_$arch.tar.xz) 11 11 pkg_hash=$(nix hash to-sri "sha256:$pkg_hash") ··· 14 14 update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-linux 15 15 } 16 16 17 - set_hash_for_arch aarch64 18 - set_hash_for_arch x86_64 17 + function set_hash_for_darwin() { 18 + local arch=$1 19 + pkg_hash=$(nix-prefetch-url https://www.reaper.fm/files/${reaper_ver%.*}.x/reaper${reaper_ver/./}_universal.dmg) 20 + pkg_hash=$(nix hash to-sri "sha256:$pkg_hash") 21 + # reset the version so the second architecture update doesn't get ignored 22 + update-source-version reaper 0 "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" --system=$arch-darwin 23 + update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-darwin 24 + } 25 + 26 + set_hash_for_linux aarch64 27 + set_hash_for_linux x86_64 28 + set_hash_for_darwin aarch64