33 # The package repo vendors some of the package dependencies as submodules.
34 # Unfortunately, they are not pinned, so we have no guarantee that they
35 # will be stable, and therefore, we can't use them directly. Instead
36 # we'll have to fetch them separately ourselves.
37 pffft-source = fetchFromBitbucket {
40 rev = "fbc4058602803f40dc554b8a5d2bcc694c005f2f";
41 sha256 = "16biji3115232cr1j975hpxw68lfybajlspnhfjcwg8jz2d8ybrf";
43 fuzzysearchdatabase-source = fetchFromBitbucket {
45 repo = "fuzzysearchdatabase";
46 rev = "23122d1ff60d936fd766361a30210c954e0c5449";
47 sha256 = "1s88blx1rn2racmb8n5g0kh1ym7v21573l5m42c4nz266vmrvrvz";
49 nanovg-source = fetchFromGitHub {
52 rev = "0bebdb314aff9cfa28fde4744bcb037a2b3fd756";
53 sha256 = "HmQhCE/zIKc3f+Zld229s5i5MWzRrBMF9gYrn8JVQzg=";
55 nanosvg-source = fetchFromGitHub {
58 rev = "9da543e8329fdd81b64eb48742d8ccb09377aed1";
59 sha256 = "1pkzv75kavkhrbdd2kvq755jyr0vamgrfr7lc33dq3ipkzmqvs2l";
61 osdialog-source = fetchFromGitHub {
64 rev = "d0f64f0798c2e47f61d90a5505910ff2d63ca049";
65 sha256 = "1d3058x6wgzw7b0wai792flk7s6ffw0z4n9sl016v91yjwv7ds3a";
67 oui-blendish-source = fetchFromGitHub {
69 repo = "oui-blendish";
70 rev = "2fc6405883f8451944ed080547d073c8f9f31898";
71 sha256 = "1bs0654312555vm7nzswsmky4l8759bjdk17pl22p49rw9k4a1px";
73 simde-source = fetchFromGitHub {
74 owner = "simd-everywhere";
76 rev = "416091ebdb9e901b29d026633e73167d6353a0b0";
77 sha256 = "064ygc6c737yjx04rydwwhkr4n4s4rbvj27swxwyzvp1h8nka6xf";
79 tinyexpr-source = fetchFromGitHub {
82 rev = "9907207e5def0fabdb60c443517b0d9e9d521393";
83 sha256 = "0xbpd09zvrk2ppm1qm1skk6p50mqr9mzjixv3s0biqq6jpabs88l";
85 fundamental-source = fetchFromGitHub {
88 rev = "5ed79544161e0fa9a55faa7c0a5f299e828e12ab"; # tip of branch v2
89 sha256 = "0c6qpigyr0ppvra20hcy1fdcmqa212jckb9wkx4f6fgdby7565wv";
91 vcv-rtaudio = stdenv.mkDerivation rec {
92 pname = "vcv-rtaudio";
93 version = "unstable-2020-01-30";
95 src = fetchFromGitHub {
98 rev = "ece277bd839603648c80c8a5f145678e13bc23f3"; # tip of master branch
99 sha256 = "11gpl0ak757ilrq4fi0brj0chmlcr1hihc32yd7qza4fxjw2yx2v";
102 nativeBuildInputs = [
114 "-DRTAUDIO_API_ALSA=ON"
115 "-DRTAUDIO_API_PULSE=ON"
116 "-DRTAUDIO_API_JACK=ON"
117 "-DRTAUDIO_API_CORE=OFF"
121 stdenv.mkDerivation rec {
127 type = "Application";
129 desktopName = "VCV Rack";
130 genericName = "Eurorack simulator";
131 comment = "Create music by patching together virtual synthesizer modules";
139 keywords = [ "music" ];
143 src = fetchFromGitHub {
147 sha256 = "1q2bwjfn6crk9lyd6m3py0v754arw1xgpv5kkj6ka1bc2yz839qh";
151 ./rack-minimize-vendoring.patch
155 # As we can't use `make dep` to set up the dependencies (as explained
156 # above), we do it here manually
159 cp -r ${pffft-source}/* dep/pffft
160 cp -r ${fuzzysearchdatabase-source}/* dep/fuzzysearchdatabase
161 cp -r ${nanovg-source}/* dep/nanovg
162 cp -r ${nanosvg-source}/* dep/nanosvg
163 cp -r ${osdialog-source}/* dep/osdialog
164 cp -r ${oui-blendish-source}/* dep/oui-blendish
165 cp -r ${simde-source}/* dep/simde
166 cp -r ${tinyexpr-source}/* dep/tinyexpr
168 cp dep/pffft/*.h dep/include
169 cp dep/fuzzysearchdatabase/src/*.hpp dep/include
170 cp dep/nanosvg/**/*.h dep/include
171 cp dep/nanovg/src/*.h dep/include
172 cp dep/osdialog/*.h dep/include
173 cp dep/oui-blendish/*.h dep/include
174 cp -r dep/simde/simde dep/include
175 cp dep/tinyexpr/tinyexpr.h dep/include
177 # Build and dist the Fundamental plugins
178 cp -r ${fundamental-source} plugins/Fundamental/
179 chmod -R +rw plugins/Fundamental # will be used as build dir
180 substituteInPlace plugin.mk --replace ":= all" ":= dist"
181 substituteInPlace plugins/Fundamental/src/Logic.cpp \
183 "LightButton<VCVBezelBig, VCVBezelLightBig<WhiteLight>>" \
184 "struct rack::componentlibrary::LightButton<VCVBezelBig, VCVBezelLightBig<WhiteLight>>"
186 # Fix reference to zenity
187 substituteInPlace dep/osdialog/osdialog_zenity.c \
188 --replace 'zenityBin[] = "zenity"' 'zenityBin[] = "${zenity}/bin/zenity"'
191 nativeBuildInputs = [
220 lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
221 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
231 install -D -m755 -t $out/bin Rack
232 install -D -m755 -t $out/lib libRack.so
234 mkdir -p $out/share/vcv-rack
235 cp -r res cacert.pem Core.json template.vcv LICENSE-GPLv3.txt $out/share/vcv-rack
236 cp -r plugins/Fundamental/dist/Fundamental-*.vcvplugin $out/share/vcv-rack/Fundamental.vcvplugin
238 # Extract pngs from the Apple icon image and create
239 # the missing ones from the 1024x1024 image.
240 icns2png --extract icon.icns
241 for size in 16 24 32 48 64 128 256 512 1024; do
242 mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps
243 if [ ! -e icon_"$size"x"$size"x32.png ] ; then
244 convert -resize "$size"x"$size" icon_1024x1024x32.png icon_"$size"x"$size"x32.png
246 install -Dm644 icon_"$size"x"$size"x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/Rack.png
252 dontWrapGApps = true;
254 # Wrap gApp and override the default global resource file directory
255 wrapProgram $out/bin/Rack \
256 "''${gappsWrapperArgs[@]}" \
257 --add-flags "-s $out/share/vcv-rack"
261 description = "Open-source virtual modular synthesizer";
262 homepage = "https://vcvrack.com/";
263 # The source is GPL3+ licensed, some of the art is CC-BY-NC 4.0 or under a
264 # no-derivatives clause
265 license = with licenses; [
268 unfreeRedistributable
270 maintainers = with maintainers; [
275 mainProgram = "Rack";
276 platforms = platforms.linux;