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

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

141 lines
3.5 KiB
Nix
Raw Normal View History

2021-01-09 07:15:41 +00:00
{ lib
2021-08-12 01:49:55 +00:00
, multiStdenv
2021-01-09 07:15:41 +00:00
, fetchFromGitHub
, substituteAll
2021-07-24 13:31:34 +00:00
, pkgsi686Linux
, libnotify
2021-01-09 07:15:41 +00:00
, meson
, ninja
, pkg-config
, wine
, boost
, libxcb
2021-07-24 13:31:34 +00:00
, nix-update-script
2021-01-09 07:15:41 +00:00
}:
let
# Derived from subprojects/bitsery.wrap
2021-07-24 13:31:34 +00:00
bitsery = fetchFromGitHub {
owner = "fraillt";
repo = "bitsery";
rev = "c0fc083c9de805e5825d7553507569febf6a6f93";
sha256 = "sha256-VwzVtxt+E/SVcxqIJw8BKPO2q7bu/hkhY+nB7FHrZpY=";
2021-01-09 07:15:41 +00:00
};
# Derived from subprojects/function2.wrap
2021-07-24 13:31:34 +00:00
function2 = fetchFromGitHub {
owner = "Naios";
repo = "function2";
rev = "02ca99831de59c7c3a4b834789260253cace0ced";
sha256 = "sha256-wrt+fCcM6YD4ZRZYvqqB+fNakCNmltdPZKlNkPLtgMs=";
2021-01-09 07:15:41 +00:00
};
# Derived from subprojects/tomlplusplus.wrap
2021-07-24 13:31:34 +00:00
tomlplusplus = fetchFromGitHub {
owner = "marzer";
repo = "tomlplusplus";
2022-01-22 15:56:56 +00:00
rev = "8e669aa6990e0ed219c169d491472d749f54c393";
sha256 = "sha256-l8ckbCqjz3GUfwStcl3H2C+un5dZfT2uLtayvdu93D4=";
2021-01-09 07:15:41 +00:00
};
2021-02-14 17:41:07 +00:00
# Derived from vst3.wrap
2021-07-24 13:31:34 +00:00
vst3 = fetchFromGitHub {
owner = "robbert-vdh";
repo = "vst3sdk";
2022-01-22 15:56:56 +00:00
rev = "v3.7.4_build_25-patched";
2021-07-24 13:31:34 +00:00
fetchSubmodules = true;
2022-01-22 15:56:56 +00:00
sha256 = "sha256-oHRJZItw+he5M+beVZkUrhJir6rgFZ80ORzA73mJT2A=";
2021-02-14 17:41:07 +00:00
};
2021-08-12 01:49:55 +00:00
in multiStdenv.mkDerivation rec {
2021-01-09 07:15:41 +00:00
pname = "yabridge";
2022-04-23 17:47:04 +00:00
version = "3.8.1";
2021-01-09 07:15:41 +00:00
2021-03-10 14:14:11 +00:00
# NOTE: Also update yabridgectl's cargoHash when this is updated
2021-01-09 07:15:41 +00:00
src = fetchFromGitHub {
owner = "robbert-vdh";
repo = pname;
rev = version;
2022-04-23 17:47:04 +00:00
sha256 = "sha256-5Mi/aIjOKbn7guTj+AKGQRv+k7w4gzfdA9Mw4ocUlOE=";
2021-01-09 07:15:41 +00:00
};
# Unpack subproject sources
postUnpack = ''(
cd "$sourceRoot/subprojects"
2021-07-24 13:31:34 +00:00
cp -R --no-preserve=mode,ownership ${bitsery} bitsery
cp packagefiles/bitsery/* bitsery
cp -R --no-preserve=mode,ownership ${function2} function2
cp packagefiles/function2/* function2
cp -R --no-preserve=mode,ownership ${tomlplusplus} tomlplusplus
cp -R --no-preserve=mode,ownership ${vst3} vst3
2021-01-09 07:15:41 +00:00
)'';
patches = [
2021-07-24 13:31:34 +00:00
# Hard code bitbridge & runtime dependencies
(substituteAll {
2021-07-24 13:31:34 +00:00
src = ./hardcode-dependencies.patch;
boost32 = pkgsi686Linux.boost;
libxcb32 = pkgsi686Linux.xorg.libxcb;
inherit libnotify wine;
2021-10-24 16:53:21 +00:00
})
];
2021-02-14 17:41:07 +00:00
postPatch = ''
patchShebangs .
'';
2021-01-09 07:15:41 +00:00
nativeBuildInputs = [
meson
ninja
pkg-config
wine
];
buildInputs = [
boost
libxcb
];
# Meson is no longer able to pick up Boost automatically.
# https://github.com/NixOS/nixpkgs/issues/86131
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
mesonFlags = [
"--cross-file" "cross-wine.conf"
2021-08-12 01:49:55 +00:00
"-Dwith-bitbridge=true"
2021-01-09 07:15:41 +00:00
# Requires CMake and is unnecessary
"-Dtomlplusplus:generate_cmake_config=false"
2021-01-09 07:15:41 +00:00
];
installPhase = ''
runHook preInstall
2021-01-09 07:15:41 +00:00
mkdir -p "$out/bin" "$out/lib"
2021-08-12 01:49:55 +00:00
cp yabridge-group*.exe{,.so} "$out/bin"
cp yabridge-host*.exe{,.so} "$out/bin"
2021-02-14 17:41:07 +00:00
cp libyabridge-vst2.so "$out/lib"
cp libyabridge-vst3.so "$out/lib"
runHook postInstall
2021-01-09 07:15:41 +00: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
'';
2021-07-24 13:31:34 +00:00
passthru.updateScript = nix-update-script {
attrPath = pname;
};
2021-01-09 07:15:41 +00:00
meta = with lib; {
description = "Yet Another VST bridge, run Windows VST2 plugins under Linux";
homepage = "https://github.com/robbert-vdh/yabridge";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ kira-bruneau ];
2021-01-09 07:15:41 +00:00
platforms = [ "x86_64-linux" ];
};
}