Add a fix for vcvrack

This commit is contained in:
EEva (JPotier) 2019-04-30 18:02:29 +03:00
parent 0fb964be76
commit 23008ef943
2 changed files with 106 additions and 0 deletions

View file

@ -19,6 +19,11 @@ self: super:
vim-samae = super.callPackage ./vim {}; vim-samae = super.callPackage ./vim {};
# Bug fixes: # Bug fixes:
# VCVRack has a bug when used with Xmonad that makes the UI
# crash almost immediately There's a workaround documented here
# (https://github.com/VCVRack/Rack/issues/478#issuecomment-456174702) and it
# requires applying a patch on the source before building.
vcv-rack-xmonad = super.callPackage ./vcv-rack {};
scientifica-font = super.callPackage ./scientifica-font {}; scientifica-font = super.callPackage ./scientifica-font {};
curie-font = super.callPackage ./curie-font {}; curie-font = super.callPackage ./curie-font {};

101
pkgs/vcv-rack/default.nix Normal file
View file

@ -0,0 +1,101 @@
{ stdenv, makeWrapper, fetchFromBitbucket, fetchFromGitHub, pkgconfig
, alsaLib, curl, glew, glfw, gtk2-x11, jansson, libjack2, libXext, libXi
, libzip, rtaudio, rtmidi, speex }:
let
glfw-git = glfw.overrideAttrs (oldAttrs: rec {
name = "glfw-git-${version}";
version = "unstable-2018-05-29";
src = fetchFromGitHub {
owner = "glfw";
repo = "glfw";
rev = "0be4f3f75aebd9d24583ee86590a38e741db0904";
sha256 = "0zbcjgc7ks25yi949k0wjknfl00a4dqmz45mhp00k62vlq2sj0i5";
};
buildInputs = oldAttrs.buildInputs ++ [ libXext libXi ];
});
pfft-source = fetchFromBitbucket {
owner = "jpommier";
repo = "pffft";
rev = "29e4f76ac53bef048938754f32231d7836401f79";
sha256 = "084csgqa6f1a270bhybjayrh3mpyi2jimc87qkdgsqcp8ycsx1l1";
};
xmonad-patch = writeText "xmonad-workaround.patch" ''
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -20,6 +20,7 @@ static json_t *settingsToJson() {
json_t *tokenJ = json_string(gToken.c_str());
json_object_set_new(rootJ, "token", tokenJ);
+ /*
if (!windowIsMaximized()) {
// windowSize
Vec windowSize = windowGetWindowSize();
@@ -31,6 +32,7 @@ static json_t *settingsToJson() {
json_t *windowPosJ = json_pack("[f, f]", windowPos.x, windowPos.y);
json_object_set_new(rootJ, "windowPos", windowPosJ);
}
+ */
// opacity
float opacity = gToolbar->wireOpacitySlider->value;
'';
in
with stdenv.lib; stdenv.mkDerivation rec {
name = "VCV-Rack-${version}";
version = "0.6.2b";
src = fetchFromGitHub {
owner = "VCVRack";
repo = "Rack";
rev = "v${version}";
sha256 = "17ynhxcci6dyn1yi871fd8yli4924fh12pmk510djwkcj5crhas6";
fetchSubmodules = true;
};
prePatch = ''
ln -s ${pfft-source} dep/jpommier-pffft-source
mkdir -p dep/include
cp dep/jpommier-pffft-source/*.h dep/include
cp dep/nanosvg/src/*.h dep/include
cp dep/nanovg/src/*.h dep/include
cp dep/osdialog/*.h dep/include
cp dep/oui-blendish/*.h dep/include
substituteInPlace include/audio.hpp --replace "<RtAudio.h>" "<rtaudio/RtAudio.h>"
substituteInPlace compile.mk --replace "-march=nocona" ""
substituteInPlace Makefile \
--replace "-Wl,-Bstatic" "" \
--replace "-lglfw3" "-lglfw"
'';
enableParallelBuilding = true;
nativeBuildInputs = [ makeWrapper pkgconfig ];
buildInputs = [ glfw-git alsaLib curl glew gtk2-x11 jansson libjack2 libzip rtaudio rtmidi speex ];
patches = [ xmonad-workaround ];
buildFlags = "Rack";
installPhase = ''
install -D -m755 -t $out/bin Rack
cp -r res $out/
mkdir -p $out/share/rack
cp LICENSE.txt LICENSE-dist.txt $out/share/rack
# Override the default global resource file directory
wrapProgram $out/bin/Rack --add-flags "-g $out"
'';
meta = with stdenv.lib; {
description = "Open-source virtual modular synthesizer";
homepage = http://vcvrack.com/;
# The source is BSD-3 licensed, some of the art is CC-BY-NC 4.0 or unfree
license = [ licenses.bsd3 licenses.cc-by-nc-40 licenses.unfree ];
maintainers = with maintainers; [ moredread ];
platforms = platforms.linux;
};
}