32 # The package repo vendors some of the package dependencies as submodules.
33 # Unfortunately, they are not pinned, so we have no guarantee that they
34 # will be stable, and therefore, we can't use them directly. Instead
35 # we'll have to fetch them separately ourselves.
36 pffft-source = fetchFromBitbucket {
39 rev = "fbc4058602803f40dc554b8a5d2bcc694c005f2f";
40 sha256 = "16biji3115232cr1j975hpxw68lfybajlspnhfjcwg8jz2d8ybrf";
42 fuzzysearchdatabase-source = fetchFromBitbucket {
44 repo = "fuzzysearchdatabase";
45 rev = "23122d1ff60d936fd766361a30210c954e0c5449";
46 sha256 = "1s88blx1rn2racmb8n5g0kh1ym7v21573l5m42c4nz266vmrvrvz";
48 nanovg-source = fetchFromGitHub {
51 rev = "0bebdb314aff9cfa28fde4744bcb037a2b3fd756";
52 sha256 = "HmQhCE/zIKc3f+Zld229s5i5MWzRrBMF9gYrn8JVQzg=";
54 nanosvg-source = fetchFromGitHub {
57 rev = "9da543e8329fdd81b64eb48742d8ccb09377aed1";
58 sha256 = "1pkzv75kavkhrbdd2kvq755jyr0vamgrfr7lc33dq3ipkzmqvs2l";
60 osdialog-source = fetchFromGitHub {
63 rev = "d0f64f0798c2e47f61d90a5505910ff2d63ca049";
64 sha256 = "1d3058x6wgzw7b0wai792flk7s6ffw0z4n9sl016v91yjwv7ds3a";
66 oui-blendish-source = fetchFromGitHub {
68 repo = "oui-blendish";
69 rev = "2fc6405883f8451944ed080547d073c8f9f31898";
70 sha256 = "1bs0654312555vm7nzswsmky4l8759bjdk17pl22p49rw9k4a1px";
72 simde-source = fetchFromGitHub {
73 owner = "simd-everywhere";
75 rev = "416091ebdb9e901b29d026633e73167d6353a0b0";
76 sha256 = "064ygc6c737yjx04rydwwhkr4n4s4rbvj27swxwyzvp1h8nka6xf";
78 tinyexpr-source = fetchFromGitHub {
81 rev = "9907207e5def0fabdb60c443517b0d9e9d521393";
82 sha256 = "0xbpd09zvrk2ppm1qm1skk6p50mqr9mzjixv3s0biqq6jpabs88l";
84 fundamental-source = fetchFromGitHub {
87 rev = "5ed79544161e0fa9a55faa7c0a5f299e828e12ab"; # tip of branch v2
88 sha256 = "0c6qpigyr0ppvra20hcy1fdcmqa212jckb9wkx4f6fgdby7565wv";
90 vcv-rtaudio = stdenv.mkDerivation rec {
91 pname = "vcv-rtaudio";
92 version = "unstable-2020-01-30";
94 src = fetchFromGitHub {
97 rev = "ece277bd839603648c80c8a5f145678e13bc23f3"; # tip of master branch
98 sha256 = "11gpl0ak757ilrq4fi0brj0chmlcr1hihc32yd7qza4fxjw2yx2v";
101 nativeBuildInputs = [ cmake pkg-config ];
103 buildInputs = [ alsa-lib libjack2 libpulseaudio ];
106 "-DRTAUDIO_API_ALSA=ON"
107 "-DRTAUDIO_API_PULSE=ON"
108 "-DRTAUDIO_API_JACK=ON"
109 "-DRTAUDIO_API_CORE=OFF"
113 stdenv.mkDerivation rec {
119 type = "Application";
121 desktopName = "VCV Rack";
122 genericName = "Eurorack simulator";
123 comment = "Create music by patching together virtual synthesizer modules";
126 categories = [ "AudioVideo" "AudioVideoEditing" "Audio" ];
127 keywords = [ "music" ];
131 src = fetchFromGitHub {
135 sha256 = "1q2bwjfn6crk9lyd6m3py0v754arw1xgpv5kkj6ka1bc2yz839qh";
139 ./rack-minimize-vendoring.patch
143 # As we can't use `make dep` to set up the dependencies (as explained
144 # above), we do it here manually
147 cp -r ${pffft-source}/* dep/pffft
148 cp -r ${fuzzysearchdatabase-source}/* dep/fuzzysearchdatabase
149 cp -r ${nanovg-source}/* dep/nanovg
150 cp -r ${nanosvg-source}/* dep/nanosvg
151 cp -r ${osdialog-source}/* dep/osdialog
152 cp -r ${oui-blendish-source}/* dep/oui-blendish
153 cp -r ${simde-source}/* dep/simde
154 cp -r ${tinyexpr-source}/* dep/tinyexpr
156 cp dep/pffft/*.h dep/include
157 cp dep/fuzzysearchdatabase/src/*.hpp dep/include
158 cp dep/nanosvg/**/*.h dep/include
159 cp dep/nanovg/src/*.h dep/include
160 cp dep/osdialog/*.h dep/include
161 cp dep/oui-blendish/*.h dep/include
162 cp -r dep/simde/simde dep/include
163 cp dep/tinyexpr/tinyexpr.h dep/include
165 # Build and dist the Fundamental plugins
166 cp -r ${fundamental-source} plugins/Fundamental/
167 chmod -R +rw plugins/Fundamental # will be used as build dir
168 substituteInPlace plugin.mk --replace ":= all" ":= dist"
169 substituteInPlace plugins/Fundamental/src/Logic.cpp \
171 "LightButton<VCVBezelBig, VCVBezelLightBig<WhiteLight>>" \
172 "struct rack::componentlibrary::LightButton<VCVBezelBig, VCVBezelLightBig<WhiteLight>>"
174 # Fix reference to zenity
175 substituteInPlace dep/osdialog/osdialog_zenity.c \
176 --replace 'zenityBin[] = "zenity"' 'zenityBin[] = "${zenity}/bin/zenity"'
179 nativeBuildInputs = [
207 makeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
208 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
217 install -D -m755 -t $out/bin Rack
218 install -D -m755 -t $out/lib libRack.so
220 mkdir -p $out/share/vcv-rack
221 cp -r res cacert.pem Core.json template.vcv LICENSE-GPLv3.txt $out/share/vcv-rack
222 cp -r plugins/Fundamental/dist/Fundamental-*.vcvplugin $out/share/vcv-rack/Fundamental.vcvplugin
224 # Extract pngs from the Apple icon image and create
225 # the missing ones from the 1024x1024 image.
226 icns2png --extract icon.icns
227 for size in 16 24 32 48 64 128 256 512 1024; do
228 mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps
229 if [ ! -e icon_"$size"x"$size"x32.png ] ; then
230 convert -resize "$size"x"$size" icon_1024x1024x32.png icon_"$size"x"$size"x32.png
232 install -Dm644 icon_"$size"x"$size"x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/Rack.png
238 dontWrapGApps = true;
240 # Wrap gApp and override the default global resource file directory
241 wrapProgram $out/bin/Rack \
242 "''${gappsWrapperArgs[@]}" \
243 --add-flags "-s $out/share/vcv-rack"
247 description = "Open-source virtual modular synthesizer";
248 homepage = "https://vcvrack.com/";
249 # The source is GPL3+ licensed, some of the art is CC-BY-NC 4.0 or under a
250 # no-derivatives clause
251 license = with licenses; [ gpl3Plus cc-by-nc-40 unfreeRedistributable ];
252 maintainers = with maintainers; [ nathyong jpotier ddelabru ];
253 mainProgram = "Rack";
254 platforms = platforms.linux;