nixpkgs/pkgs/tools/audio/yabridge/default.nix

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

166 lines
4.1 KiB
Nix
Raw Normal View History

2021-01-09 08:15:41 +01:00
{ lib
2021-08-12 03:49:55 +02:00
, multiStdenv
2021-01-09 08:15:41 +01:00
, fetchFromGitHub
, substituteAll
2021-07-24 15:31:34 +02:00
, pkgsi686Linux
2023-01-17 19:11:14 +01:00
, dbus
2021-01-09 08:15:41 +01:00
, meson
, ninja
, pkg-config
, wine
, libxcb
2021-07-24 15:31:34 +02:00
, nix-update-script
2021-01-09 08:15:41 +01:00
}:
let
2022-07-06 15:56:07 +02:00
# Derived from subprojects/asio.wrap
asio = fetchFromGitHub {
owner = "chriskohlhoff";
repo = "asio";
rev = "asio-1-22-1";
sha256 = "sha256-UDLhx2yI6Txg0wP5H4oNIhgKIB2eMxUGCyT2x/7GgVg=";
};
2021-01-09 08:15:41 +01:00
# Derived from subprojects/bitsery.wrap
2021-07-24 15:31:34 +02:00
bitsery = fetchFromGitHub {
owner = "fraillt";
repo = "bitsery";
2022-07-06 15:56:07 +02:00
rev = "v5.2.2";
2021-07-24 15:31:34 +02:00
sha256 = "sha256-VwzVtxt+E/SVcxqIJw8BKPO2q7bu/hkhY+nB7FHrZpY=";
2021-01-09 08:15:41 +01:00
};
2023-01-17 19:11:14 +01:00
# Derived from subprojects/clap.wrap
clap = fetchFromGitHub {
owner = "free-audio";
repo = "clap";
rev = "1.1.4";
sha256 = "sha256-3zDvzC3Hs4OmT2qvaDa69rmBkHoQ8qY9TZlsPxsJA40=";
};
2021-01-09 08:15:41 +01:00
# Derived from subprojects/function2.wrap
2021-07-24 15:31:34 +02:00
function2 = fetchFromGitHub {
owner = "Naios";
repo = "function2";
2022-07-06 15:56:07 +02:00
rev = "4.2.0";
2021-07-24 15:31:34 +02:00
sha256 = "sha256-wrt+fCcM6YD4ZRZYvqqB+fNakCNmltdPZKlNkPLtgMs=";
2021-01-09 08:15:41 +01:00
};
2022-07-06 15:56:07 +02:00
# Derived from subprojects/ghc_filesystem.wrap
ghc_filesystem = fetchFromGitHub {
owner = "gulrak";
repo = "filesystem";
rev = "v1.5.12";
sha256 = "sha256-j4RE5Ach7C7Kef4+H9AHSXa2L8OVyJljDwBduKcC4eE=";
};
2021-01-09 08:15:41 +01:00
# Derived from subprojects/tomlplusplus.wrap
2021-07-24 15:31:34 +02:00
tomlplusplus = fetchFromGitHub {
owner = "marzer";
repo = "tomlplusplus";
2022-07-06 15:56:07 +02:00
rev = "v3.0.1";
2022-01-22 16:56:56 +01:00
sha256 = "sha256-l8ckbCqjz3GUfwStcl3H2C+un5dZfT2uLtayvdu93D4=";
2021-01-09 08:15:41 +01:00
};
2021-02-14 18:41:07 +01:00
# Derived from vst3.wrap
2021-07-24 15:31:34 +02:00
vst3 = fetchFromGitHub {
owner = "robbert-vdh";
repo = "vst3sdk";
2023-01-17 19:11:14 +01:00
rev = "v3.7.7_build_19-patched";
2021-07-24 15:31:34 +02:00
fetchSubmodules = true;
2023-01-17 19:11:14 +01:00
sha256 = "sha256-LsPHPoAL21XOKmF1Wl/tvLJGzjaCLjaDAcUtDvXdXSU=";
2021-02-14 18:41:07 +01:00
};
2021-08-12 03:49:55 +02:00
in multiStdenv.mkDerivation rec {
2021-01-09 08:15:41 +01:00
pname = "yabridge";
2023-01-17 19:11:14 +01:00
version = "5.0.3";
2021-01-09 08:15:41 +01:00
2021-03-10 15:14:11 +01:00
# NOTE: Also update yabridgectl's cargoHash when this is updated
2021-01-09 08:15:41 +01:00
src = fetchFromGitHub {
owner = "robbert-vdh";
repo = pname;
rev = version;
2023-01-17 19:11:14 +01:00
sha256 = "sha256-T3BU77BbVr6vlVoijUQy86eF0lCgM4S4d5VSnLE4pas=";
2021-01-09 08:15:41 +01:00
};
# Unpack subproject sources
postUnpack = ''(
cd "$sourceRoot/subprojects"
2022-07-06 15:56:07 +02:00
cp -R --no-preserve=mode,ownership ${asio} asio
2021-07-24 15:31:34 +02:00
cp -R --no-preserve=mode,ownership ${bitsery} bitsery
2023-01-17 19:11:14 +01:00
cp -R --no-preserve=mode,ownership ${clap} clap
2021-07-24 15:31:34 +02:00
cp -R --no-preserve=mode,ownership ${function2} function2
2022-07-06 15:56:07 +02:00
cp -R --no-preserve=mode,ownership ${ghc_filesystem} ghc_filesystem
2021-07-24 15:31:34 +02:00
cp -R --no-preserve=mode,ownership ${tomlplusplus} tomlplusplus
cp -R --no-preserve=mode,ownership ${vst3} vst3
2021-01-09 08:15:41 +01:00
)'';
patches = [
2021-07-24 15:31:34 +02:00
# Hard code bitbridge & runtime dependencies
(substituteAll {
2021-07-24 15:31:34 +02:00
src = ./hardcode-dependencies.patch;
libxcb32 = pkgsi686Linux.xorg.libxcb;
2023-01-17 19:11:14 +01:00
inherit wine;
2021-10-24 18:53:21 +02:00
})
2022-07-06 15:56:07 +02:00
# Patch the chainloader to search for libyabridge through NIX_PROFILES
./libyabridge-from-nix-profiles.patch
];
2021-02-14 18:41:07 +01:00
postPatch = ''
patchShebangs .
2022-07-06 15:56:07 +02:00
(
cd subprojects
cp packagefiles/asio/* asio
cp packagefiles/bitsery/* bitsery
2023-01-17 19:11:14 +01:00
cp packagefiles/clap/* clap
2022-07-06 15:56:07 +02:00
cp packagefiles/function2/* function2
cp packagefiles/ghc_filesystem/* ghc_filesystem
)
2021-02-14 18:41:07 +01:00
'';
2021-01-09 08:15:41 +01:00
nativeBuildInputs = [
meson
ninja
pkg-config
wine
];
buildInputs = [
libxcb
2023-01-17 19:11:14 +01:00
dbus
2021-01-09 08:15:41 +01:00
];
mesonFlags = [
"--cross-file" "cross-wine.conf"
2022-07-06 15:56:07 +02:00
"-Dbitbridge=true"
2021-01-09 08:15:41 +01:00
# Requires CMake and is unnecessary
"-Dtomlplusplus:generate_cmake_config=false"
2021-01-09 08:15:41 +01:00
];
installPhase = ''
runHook preInstall
2021-01-09 08:15:41 +01:00
mkdir -p "$out/bin" "$out/lib"
2022-07-06 15:56:07 +02:00
cp yabridge-host{,-32}.exe{,.so} "$out/bin"
2023-01-17 19:11:14 +01:00
cp libyabridge{,-chainloader}-{vst2,vst3,clap}.so "$out/lib"
runHook postInstall
2021-01-09 08:15:41 +01:00
'';
# Hard code wine path in wrapper scripts generated by winegcc
postFixup = ''
for exe in "$out"/bin/*.exe; do
substituteInPlace "$exe" \
--replace 'WINELOADER="wine"' 'WINELOADER="${wine}/bin/wine"'
done
'';
passthru.updateScript = nix-update-script { };
2021-07-24 15:31:34 +02:00
2021-01-09 08:15:41 +01:00
meta = with lib; {
2022-07-06 15:56:07 +02:00
description = "A modern and transparent way to use Windows VST2 and VST3 plugins on Linux";
homepage = src.meta.homepage;
2021-01-09 08:15:41 +01:00
license = licenses.gpl3Plus;
maintainers = with maintainers; [ kira-bruneau ];
2021-01-09 08:15:41 +01:00
platforms = [ "x86_64-linux" ];
};
}