overlays-personal/pkgs/vcv-rack/default.nix

81 lines
2.8 KiB
Nix

{ gcc11Stdenv, lib, makeWrapper, fetchzip, fetchFromGitHub, pkg-config
, alsa-lib, curl, ghc_filesystem, glew, glfw, gtk3-x11, jansson, jq, libarchive
, libjack2, libpulseaudio, libXext, libXi, rtaudio, rtmidi, speex
, libsamplerate, zstd, wrapGAppsHook }:
let
fundamental-source = fetchFromGitHub {
owner = "VCVRack";
repo = "Fundamental";
rev = "533397cdcad5c6401ebd3937d6c1663de2473627"; # tip of branch v2
sha256 = "QnwOgrYxiCa/7t/u6F63Ks8C9E8k6T+hia4JZFhp1LI=";
};
in
# gcc11 is necessary because many vcv plugins are already built with it
# If using an older gcc for Rack, you get
# undefined symbol: _ZSt28__throw_bad_array_new_lengthv
# for those plugins which were built with v11
with lib; gcc11Stdenv.mkDerivation rec {
pname = "VCV-Rack";
version = "2.0.1";
src = fetchFromGitHub {
owner = "VCVRack";
repo = "Rack";
rev = "v${version}";
sha256 = "gy+YiYhgBO9eoEBP0PmteVjfaJWWIa/Ye9tvJG1b6aw=";
# The project pins some source dependencies (see below)
fetchSubmodules = true;
};
patches = [
./rack-minimize-vendoring.patch
];
prePatch = ''
# Not sure if it's possible to use make dep yet
mkdir -p dep/include
cp dep/pffft/*.h dep/include
cp dep/fuzzysearchdatabase/src/*.hpp dep/include
cp dep/nanosvg/**/*.h dep/include
cp dep/nanovg/src/*.h dep/include
cp dep/osdialog/*.h dep/include
cp dep/oui-blendish/*.h dep/include
# Build and dist the Fundamental plugins
cp -r ${fundamental-source} plugins/Fundamental/
chmod -R +rw plugins/Fundamental # will be used as build dir
substituteInPlace plugin.mk --replace ":= all" ":= dist"
'';
enableParallelBuilding = true;
nativeBuildInputs = [ makeWrapper pkg-config wrapGAppsHook ];
buildInputs = [ alsa-lib curl ghc_filesystem glew glfw gtk3-x11 jansson jq libarchive libjack2 libpulseaudio libsamplerate rtaudio rtmidi speex zstd ];
makeFlags = [ "all" "plugins" ];
installPhase = ''
install -D -m755 -t $out/bin Rack
install -D -m755 -t $out/lib libRack.so
mkdir -p $out/share/vcv-rack
cp -r res cacert.pem Core.json template.vcv LICENSE-GPLv3.txt $out/share/vcv-rack
cp -r plugins/Fundamental/dist/Fundamental-*.vcvplugin $out/share/vcv-rack/Fundamental.vcvplugin
# Override the default global resource file directory
wrapProgram $out/bin/Rack --add-flags "-s $out/share/vcv-rack"
'';
meta = with lib; {
description = "Open-source virtual modular synthesizer";
homepage = "https://vcvrack.com/";
# The source is BSD-3 licensed, some of the art is CC-BY-NC 4.0 or under a
# no-derivatives clause
license = with licenses; [ bsd3 cc-by-nc-40 unfreeRedistributable ];
maintainers = with maintainers; [ moredread nathyong jpotier ];
platforms = platforms.linux;
};
}