nixpkgs/pkgs/applications/audio/reaper/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

111 lines
3.3 KiB
Nix
Raw Normal View History

{ config, lib, stdenv
, fetchurl
, autoPatchelfHook
, makeWrapper
2023-11-04 12:53:03 +00:00
, undmg
, alsa-lib
, curl
, gtk3
, lame
, libxml2
, ffmpeg
, vlc
2021-03-31 10:05:14 +00:00
, xdg-utils
, xdotool
2021-03-31 10:05:14 +00:00
, which
2023-11-04 12:53:03 +00:00
, jackSupport ? stdenv.isLinux
2022-06-26 11:26:03 +00:00
, jackLibrary
2023-11-04 12:53:03 +00:00
, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux
2022-06-26 11:26:03 +00:00
, libpulseaudio
2018-08-03 11:36:11 +00:00
}:
2022-07-04 03:51:51 +00:00
let
2023-11-04 12:53:03 +00:00
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";
2022-07-04 03:51:51 +00:00
in
2019-01-13 22:25:47 +00:00
stdenv.mkDerivation rec {
pname = "reaper";
2024-04-14 07:25:07 +00:00
version = "7.14";
2018-08-03 11:36:11 +00:00
src = fetchurl {
2022-07-04 03:51:51 +00:00
url = url_for_platform version stdenv.hostPlatform.qemuArch;
2024-04-14 07:25:07 +00:00
hash = if stdenv.isDarwin then "sha256-cPxHriUNIG1EUmvOoW00V2Y0j+7BuxSIEbPy+qy5ZEM=" else {
x86_64-linux = "sha256-RgKteq157r4r088mr9wvPPa/rhmX88/lmVJ7mS17px4=";
aarch64-linux = "sha256-Qnb6ZoDIkfRct6dvqXKeYHgXyyEFLSj9R0hwa2bUiXo=";
}.${stdenv.hostPlatform.system};
2018-08-03 11:36:11 +00:00
};
2021-03-31 10:05:14 +00:00
nativeBuildInputs = [
makeWrapper
2023-11-04 12:53:03 +00:00
] ++ lib.optionals stdenv.isLinux [
2021-03-31 10:05:14 +00:00
which
2023-11-04 12:53:03 +00:00
autoPatchelfHook
xdg-utils # Required for desktop integration
] ++ lib.optionals stdenv.isDarwin [
undmg
2021-03-31 10:05:14 +00:00
];
2018-08-03 11:36:11 +00:00
2023-11-04 12:53:03 +00:00
sourceRoot = lib.optionalString stdenv.isDarwin "Reaper.app";
2018-08-03 11:36:11 +00:00
buildInputs = [
stdenv.cc.cc.lib # reaper and libSwell need libstdc++.so.6
2023-11-04 12:53:03 +00:00
] ++ lib.optionals stdenv.isLinux [
gtk3
2023-11-04 12:53:03 +00:00
alsa-lib
2019-01-13 22:25:47 +00:00
];
2023-11-04 12:53:03 +00:00
runtimeDependencies = lib.optionals stdenv.isLinux [
gtk3 # libSwell needs libgdk-3.so.0
]
2022-06-26 11:26:03 +00:00
++ lib.optional jackSupport jackLibrary
++ lib.optional pulseaudioSupport libpulseaudio;
2018-08-03 11:36:11 +00:00
dontBuild = true;
2023-11-04 12:53:03 +00:00
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 ''
2021-02-16 02:30:36 +00:00
runHook preInstall
2021-03-31 10:05:14 +00:00
HOME="$out/share" XDG_DATA_HOME="$out/share" ./install-reaper.sh \
2019-01-13 22:25:47 +00:00
--install $out/opt \
--integrate-user-desktop
2018-08-03 11:36:11 +00:00
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.
2018-08-04 07:56:04 +00:00
wrapProgram $out/opt/REAPER/reaper \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ curl lame libxml2 ffmpeg vlc xdotool stdenv.cc.cc.lib ]}"
2018-08-03 11:36:11 +00:00
mkdir $out/bin
2018-08-04 07:56:04 +00:00
ln -s $out/opt/REAPER/reaper $out/bin/
2018-08-03 11:36:11 +00:00
ln -s $out/opt/REAPER/reamote-server $out/bin/
2021-02-16 02:30:36 +00:00
runHook postInstall
2018-08-03 11:36:11 +00:00
'';
2022-07-04 03:51:51 +00:00
passthru.updateScript = ./updater.sh;
meta = with lib; {
2018-08-03 11:36:11 +00:00
description = "Digital audio workstation";
homepage = "https://www.reaper.fm/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
2018-08-03 11:36:11 +00:00
license = licenses.unfree;
2023-11-04 12:53:03 +00:00
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
maintainers = with maintainers; [ ilian orivej uniquepointer viraptor ];
2018-08-03 11:36:11 +00:00
};
}