Skip to content

Commit

Permalink
reaper: 7.28 -> 7.29 (NixOS#371095)
Browse files Browse the repository at this point in the history
  • Loading branch information
viraptor authored Jan 8, 2025
2 parents 1489dd8 + ec998e4 commit bd2a4bf
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 84 deletions.
210 changes: 128 additions & 82 deletions pkgs/applications/audio/reaper/default.nix
Original file line number Diff line number Diff line change
@@ -1,100 +1,135 @@
{ config, lib, stdenv
, fetchurl
, autoPatchelfHook
, makeWrapper
, undmg

, alsa-lib
, curl
, gtk3
, lame
, libxml2
, ffmpeg
, vlc
, xdg-utils
, xdotool
, which

, jackSupport ? stdenv.hostPlatform.isLinux
, jackLibrary
, pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux
, libpulseaudio
{
config,
lib,
stdenv,
fetchurl,
autoPatchelfHook,
makeWrapper,
undmg,

alsa-lib,
curl,
gtk3,
lame,
libxml2,
ffmpeg,
vlc,
xdg-utils,
xdotool,
which,

jackSupport ? stdenv.hostPlatform.isLinux,
jackLibrary,
pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux,
libpulseaudio,
}:

let
url_for_platform = version: arch: if stdenv.hostPlatform.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";
url_for_platform =
version: arch:
if stdenv.hostPlatform.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";
version = "7.28";
version = "7.29";

src = fetchurl {
url = url_for_platform version stdenv.hostPlatform.qemuArch;
hash = if stdenv.hostPlatform.isDarwin then "sha256-bhrBIXrE3gaAjpqrOtFK9Awb3rKMIckYhpQKVioBbqY=" else {
x86_64-linux = "sha256-HTxuu1IfjDYnCRksW5tjbOLIFz150wBwyJKCkMATlAk=";
aarch64-linux = "sha256-3jH6UwQefhLyymGltw7+//tUaO0V/3VySWuDsS3cqSo=";
}.${stdenv.hostPlatform.system};
hash =
if stdenv.hostPlatform.isDarwin then
"sha256-b1Gb5guaFyWrt9KEwptuXGvfrJAvgnFEl8QuwSufktE="
else
{
x86_64-linux = "sha256-uFK8Y36pYTDK3foCKH9kiq3u1MTir2nNM5KrDwIHEm0=";
aarch64-linux = "sha256-KZTUeEtyAVwIFTmclYv4GcGJ2WXukEF0/mfYmmBPfz0=";
}
.${stdenv.hostPlatform.system};
};

nativeBuildInputs = [
makeWrapper
] ++ lib.optionals stdenv.hostPlatform.isLinux [
which
autoPatchelfHook
xdg-utils # Required for desktop integration
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
undmg
];
nativeBuildInputs =
[
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isLinux [
which
autoPatchelfHook
xdg-utils # Required for desktop integration
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
undmg
];

sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin "Reaper.app";

buildInputs = [
(lib.getLib stdenv.cc.cc) # reaper and libSwell need libstdc++.so.6
] ++ lib.optionals stdenv.hostPlatform.isLinux [
gtk3
alsa-lib
];

runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux [
gtk3 # libSwell needs libgdk-3.so.0
]
++ lib.optional jackSupport jackLibrary
++ lib.optional pulseaudioSupport libpulseaudio;
buildInputs =
[
(lib.getLib stdenv.cc.cc) # reaper and libSwell need libstdc++.so.6
]
++ lib.optionals stdenv.hostPlatform.isLinux [
gtk3
alsa-lib
];

runtimeDependencies =
lib.optionals stdenv.hostPlatform.isLinux [
gtk3 # libSwell needs libgdk-3.so.0
]
++ lib.optional jackSupport jackLibrary
++ lib.optional pulseaudioSupport libpulseaudio;

dontBuild = true;

installPhase = if stdenv.hostPlatform.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 \
--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 ]}"
mkdir $out/bin
ln -s $out/opt/REAPER/reaper $out/bin/
runHook postInstall
'';
installPhase =
if stdenv.hostPlatform.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 \
--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
]
}"
mkdir $out/bin
ln -s $out/opt/REAPER/reaper $out/bin/
runHook postInstall
'';

passthru.updateScript = ./updater.sh;

Expand All @@ -103,7 +138,18 @@ stdenv.mkDerivation rec {
homepage = "https://www.reaper.fm/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
maintainers = with maintainers; [ ilian orivej uniquepointer viraptor ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
maintainers = with maintainers; [
atinba
ilian
orivej
uniquepointer
viraptor
];
};
}
4 changes: 2 additions & 2 deletions pkgs/applications/audio/reaper/updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ reaper_ver=$(curl -Ls https://www.reaper.fm/download.php | grep -o 'Version [0-9
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")
pkg_hash=$(nix hash convert "sha256:$pkg_hash")
update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-linux --ignore-same-version
}

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")
pkg_hash=$(nix hash convert "sha256:$pkg_hash")
update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-darwin --ignore-same-version
}

Expand Down

0 comments on commit bd2a4bf

Please sign in to comment.