summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-11-17 16:04:49 +0100
committerGitHub <noreply@github.com>2023-11-17 16:04:49 +0100
commitc7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09 (patch)
tree1b6b55e87e1aebe0e88f78d3fdcbfc3b9c10e5dd /pkgs
parent309c806b050f73eaf01010964088335bfd36c959 (diff)
parentf7bfb80a24102831d4667094093ed9592f90f281 (diff)
downloadnixpkgs-c7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09.tar
nixpkgs-c7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09.tar.gz
nixpkgs-c7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09.tar.bz2
nixpkgs-c7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09.tar.lz
nixpkgs-c7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09.tar.xz
nixpkgs-c7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09.tar.zst
nixpkgs-c7f0bbcf2c4d42b39a5dd5ba30497c2d157a7e09.zip
Merge pull request #266834 from viraptor/reaper-darwin
reaper: darwin platform
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/reaper/default.nix35
-rwxr-xr-xpkgs/applications/audio/reaper/updater.sh16
2 files changed, 38 insertions, 13 deletions
diff --git a/pkgs/applications/audio/reaper/default.nix b/pkgs/applications/audio/reaper/default.nix
index b5cf860ad9b..dcbb7586eeb 100644
--- a/pkgs/applications/audio/reaper/default.nix
+++ b/pkgs/applications/audio/reaper/default.nix
@@ -2,6 +2,7 @@
 , fetchurl
 , autoPatchelfHook
 , makeWrapper
+, undmg
 
 , alsa-lib
 , curl
@@ -14,14 +15,16 @@
 , xdotool
 , which
 
-, jackSupport ? true
+, jackSupport ? stdenv.isLinux
 , jackLibrary
-, pulseaudioSupport ? config.pulseaudio or true
+, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux
 , libpulseaudio
 }:
 
 let
-  url_for_platform = version: arch: "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${builtins.replaceStrings ["."] [""] version}_linux_${arch}.tar.xz";
+  url_for_platform = version: arch: if stdenv.isDarwin
+    then "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${builtins.replaceStrings ["."] [""] version}_universal.dmg"
+    else "https://www.reaper.fm/files/${lib.versions.major version}.x/reaper${builtins.replaceStrings ["."] [""] version}_linux_${arch}.tar.xz";
 in
 stdenv.mkDerivation rec {
   pname = "reaper";
@@ -29,26 +32,32 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = url_for_platform version stdenv.hostPlatform.qemuArch;
-    hash = {
+    hash = if stdenv.isDarwin then "sha256-jaT+3cIFVfBopgeeTkpNs9rFX50unlPJogdhkI9bsWU=" else {
       x86_64-linux = "sha256-P/PnbJPr4ErDz5ho1/dLERhqkKjdetHzKpCpfVZAYb0=";
       aarch64-linux = "sha256-PdnBVlHwoEEv2SPq/p5oyiOlduCEqL35gAY+QIJU1Ys=";
     }.${stdenv.hostPlatform.system};
   };
 
   nativeBuildInputs = [
-    autoPatchelfHook
     makeWrapper
-    xdg-utils # Required for desktop integration
+  ] ++ lib.optionals stdenv.isLinux [
     which
+    autoPatchelfHook
+    xdg-utils # Required for desktop integration
+  ] ++ lib.optionals stdenv.isDarwin [
+    undmg
   ];
 
+  sourceRoot = lib.optionalString stdenv.isDarwin "Reaper.app";
+
   buildInputs = [
-    alsa-lib
     stdenv.cc.cc.lib # reaper and libSwell need libstdc++.so.6
+  ] ++ lib.optionals stdenv.isLinux [
     gtk3
+    alsa-lib
   ];
 
-  runtimeDependencies = [
+  runtimeDependencies = lib.optionals stdenv.isLinux [
     gtk3 # libSwell needs libgdk-3.so.0
   ]
   ++ lib.optional jackSupport jackLibrary
@@ -56,7 +65,13 @@ stdenv.mkDerivation rec {
 
   dontBuild = true;
 
-  installPhase = ''
+  installPhase = if stdenv.isDarwin then ''
+    runHook preInstall
+    mkdir -p "$out/Applications/Reaper.app"
+    cp -r * "$out/Applications/Reaper.app/"
+    makeWrapper "$out/Applications/Reaper.app/Contents/MacOS/REAPER" "$out/bin/reaper"
+    runHook postInstall
+  '' else ''
     runHook preInstall
 
     HOME="$out/share" XDG_DATA_HOME="$out/share" ./install-reaper.sh \
@@ -89,7 +104,7 @@ stdenv.mkDerivation rec {
     homepage = "https://www.reaper.fm/";
     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
     license = licenses.unfree;
-    platforms = [ "x86_64-linux" "aarch64-linux" ];
+    platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
     maintainers = with maintainers; [ jfrankenau ilian orivej uniquepointer viraptor ];
   };
 }
diff --git a/pkgs/applications/audio/reaper/updater.sh b/pkgs/applications/audio/reaper/updater.sh
index 750bea346bb..31832f7173c 100755
--- a/pkgs/applications/audio/reaper/updater.sh
+++ b/pkgs/applications/audio/reaper/updater.sh
@@ -5,7 +5,7 @@ set -euo pipefail
 
 reaper_ver=$(curl -Ls https://www.reaper.fm/download.php | grep -o 'Version [0-9]\.[0-9]*' | head -n1 | cut -d' ' -f2)
 
-function set_hash_for_arch() {
+function set_hash_for_linux() {
   local arch=$1
   pkg_hash=$(nix-prefetch-url https://www.reaper.fm/files/${reaper_ver%.*}.x/reaper${reaper_ver/./}_linux_$arch.tar.xz)
   pkg_hash=$(nix hash to-sri "sha256:$pkg_hash")
@@ -14,5 +14,15 @@ function set_hash_for_arch() {
   update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-linux
 }
 
-set_hash_for_arch aarch64
-set_hash_for_arch x86_64
+function set_hash_for_darwin() {
+  local arch=$1
+  pkg_hash=$(nix-prefetch-url https://www.reaper.fm/files/${reaper_ver%.*}.x/reaper${reaper_ver/./}_universal.dmg)
+  pkg_hash=$(nix hash to-sri "sha256:$pkg_hash")
+  # reset the version so the second architecture update doesn't get ignored
+  update-source-version reaper 0 "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" --system=$arch-darwin
+  update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-darwin
+}
+
+set_hash_for_linux aarch64
+set_hash_for_linux x86_64
+set_hash_for_darwin aarch64