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

131 lines
4.7 KiB
Nix
Raw Normal View History

2022-04-10 19:23:56 +02:00
{ gcc10Stdenv, lib, makeWrapper, fetchzip, fetchFromGitHub, fetchFromBitbucket
2021-12-06 22:13:34 +01:00
, pkg-config, alsa-lib, curl, ghc_filesystem, glew, glfw, gtk3-x11, jansson, jq
, libarchive, libjack2, libpulseaudio, libXext, libXi, rtaudio, rtmidi, speex
2022-01-17 21:17:49 +01:00
, libsamplerate, zstd, wrapGAppsHook, gnome }:
2021-01-01 10:39:15 +01:00
let
2021-12-06 22:13:34 +01:00
# The package repo vendors some of the package dependencies as submodules.
# Unfortunately, they are not pinned, so we have no guarantee that they
# will be stable, and therefore, we can't use them directly. Instead
# we'll have to fetch them separately ourselves.
pffft-source = fetchFromBitbucket {
owner = "jpommier";
repo = "pffft";
2022-04-10 19:23:56 +02:00
rev = "7c3b5a7dc510a0f513b9c5b6dc5b56f7aeeda422";
sha256 = "X+7ZDXaURWpNLh0PuEw4VhbUpGupgjwWezcraLJYcgo=";
2021-12-06 22:13:34 +01:00
};
fuzzysearchdatabase-source = fetchFromBitbucket {
owner = "j_norberg";
repo = "fuzzysearchdatabase";
rev = "fe62479811e503ef3c091f5a859d27bfcf0a44da";
sha256 = "zgeUzuuInHPeveBIjlivRGIz+NSb7cW/9hMndxm6qOA=";
};
nanovg-source = fetchFromGitHub {
owner = "VCVRack";
repo = "nanovg";
rev = "0bebdb314aff9cfa28fde4744bcb037a2b3fd756";
sha256 = "HmQhCE/zIKc3f+Zld229s5i5MWzRrBMF9gYrn8JVQzg=";
};
nanosvg-source = fetchFromGitHub {
owner = "memononen";
repo = "nanosvg";
2022-04-10 19:23:56 +02:00
rev = "214cf85efcdc67524335ad0e2a2d5982246b6a72";
sha256 = "M3QwIgcPC3nMW7bBQ1xSu/tUV2SRNJvs4u9ldCg+Wto=";
2021-12-06 22:13:34 +01:00
};
osdialog-source = fetchFromGitHub {
owner = "AndrewBelt";
repo = "osdialog";
2022-01-17 21:17:49 +01:00
rev = "21b9dcc2a1bbdacb9b46da477ffd82a4ce9204b9";
sha256 = "+4VCBuQvfiuEUdjFu3IB2FwbHFrDJXTb4vcVg6ZFwSM=";
2021-12-06 22:13:34 +01:00
};
oui-blendish-source = fetchFromGitHub {
owner = "AndrewBelt";
repo = "oui-blendish";
rev = "2fc6405883f8451944ed080547d073c8f9f31898";
sha256 = "/QZFZuI5kSsEvSfMJlcqB1HiZ9Vcf3vqLqWIMEgxQK8=";
};
2021-12-02 23:12:37 +01:00
fundamental-source = fetchFromGitHub {
owner = "VCVRack";
repo = "Fundamental";
2022-04-10 19:23:56 +02:00
rev = "2ca55fd1c20505f3abbdac407d11188e13d62a33"; # tip of branch v2
sha256 = "OICKuTGa4PcKuGbkBDseUnPMQo6+yEaPHaQVQ51dSJQ=";
2021-01-01 10:39:15 +01:00
};
in
2021-12-03 00:00:59 +01:00
# 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
2022-04-10 19:23:56 +02:00
with lib; gcc10Stdenv.mkDerivation rec {
2021-01-01 10:39:15 +01:00
pname = "VCV-Rack";
2022-04-10 19:23:56 +02:00
version = "2.1.0";
2021-01-01 10:39:15 +01:00
src = fetchFromGitHub {
owner = "VCVRack";
repo = "Rack";
rev = "v${version}";
2022-04-10 19:23:56 +02:00
sha256 = "wb8OlcRVeOuMWW6OlilKgRfEljqgU8lU2PGoqnWUAdc=";
2021-01-01 10:39:15 +01:00
};
patches = [
./rack-minimize-vendoring.patch
];
prePatch = ''
2021-12-06 22:13:34 +01:00
# As we can't use `make dep` to set up the dependencies (as explained
# above), we do it here manually
2021-01-01 10:39:15 +01:00
mkdir -p dep/include
2021-12-06 22:13:34 +01:00
cp -r ${pffft-source}/* dep/pffft
cp -r ${fuzzysearchdatabase-source}/* dep/fuzzysearchdatabase
cp -r ${nanovg-source}/* dep/nanovg
cp -r ${nanosvg-source}/* dep/nanosvg
cp -r ${osdialog-source}/* dep/osdialog
cp -r ${oui-blendish-source}/* dep/oui-blendish
2021-12-02 23:12:37 +01:00
cp dep/pffft/*.h dep/include
cp dep/fuzzysearchdatabase/src/*.hpp dep/include
2021-01-01 10:39:15 +01:00
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
2021-12-03 18:19:20 +01:00
# Build and dist the Fundamental plugins
2021-12-02 23:12:37 +01:00
cp -r ${fundamental-source} plugins/Fundamental/
chmod -R +rw plugins/Fundamental # will be used as build dir
substituteInPlace plugin.mk --replace ":= all" ":= dist"
2022-01-17 21:17:49 +01:00
# Fix reference to zenity
substituteInPlace dep/osdialog/osdialog_zenity.c \
--replace 'zenityBin[] = "zenity"' 'zenityBin[] = "${gnome.zenity}/bin/zenity"'
2021-01-01 10:39:15 +01:00
'';
enableParallelBuilding = true;
2021-12-07 17:21:55 +01:00
nativeBuildInputs = [ makeWrapper pkg-config wrapGAppsHook jq ];
2022-01-17 21:17:49 +01:00
buildInputs = [ alsa-lib curl ghc_filesystem glew glfw gtk3-x11 jansson libarchive libjack2 libpulseaudio libsamplerate rtaudio rtmidi speex zstd gnome.zenity ];
2021-01-01 10:39:15 +01:00
2021-12-02 23:12:37 +01:00
makeFlags = [ "all" "plugins" ];
2021-01-01 10:39:15 +01:00
installPhase = ''
install -D -m755 -t $out/bin Rack
2021-12-02 23:12:37 +01:00
install -D -m755 -t $out/lib libRack.so
2021-01-01 10:39:15 +01:00
mkdir -p $out/share/vcv-rack
2021-12-02 23:12:37 +01:00
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
2021-01-01 10:39:15 +01:00
# Override the default global resource file directory
wrapProgram $out/bin/Rack --add-flags "-s $out/share/vcv-rack"
'';
2021-03-03 12:59:53 +01:00
meta = with lib; {
2021-01-01 10:39:15 +01:00
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 ];
2021-12-03 18:46:28 +01:00
maintainers = with maintainers; [ moredread nathyong jpotier ];
2021-01-01 10:39:15 +01:00
platforms = platforms.linux;
};
}