···
1
+
{ stdenv, fetchurl, alsaLib, bzip2, cairo, dpkg, freetype, gdk_pixbuf
2
+
, glib, gtk, harfbuzz, jdk, lib, libX11, libXau, libXcursor, libXdmcp
3
+
, libXext, libXfixes, libXrender, libbsd, libjack2, libpng, libxcb
4
+
, libxkbcommon, libxkbfile, makeWrapper, pixman, xcbutil, xcbutilwm
5
+
, xdg_utils, zenity, zlib }:
7
+
stdenv.mkDerivation rec {
8
+
name = "bitwig-studio-${version}";
12
+
url = "https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb";
13
+
sha256 = "01z6yia4a6lfsf3rqq379l7xzqfbpz27mf1mr8sx9z1a8rzzyhld";
16
+
nativeBuildInputs = [ dpkg makeWrapper ];
18
+
unpackCmd = "mkdir root ; dpkg-deb -x $curSrc root";
21
+
dontPatchELF = true;
24
+
libPath = lib.makeLibraryPath [
25
+
alsaLib bzip2.out cairo freetype gdk_pixbuf glib gtk harfbuzz
26
+
libX11 libXau libXcursor libXdmcp libXext libXfixes libXrender
27
+
libbsd libjack2 libpng libxcb libxkbfile pixman xcbutil xcbutilwm
31
+
binPath = lib.makeBinPath [
37
+
cp -r opt/bitwig-studio $out/libexec
39
+
# Use NixOS versions of these libs instead of the bundled ones.
41
+
cd $out/libexec/lib/bitwig-studio
42
+
rm libbz2.so* libxkbfile.so* libXcursor.so* libXau.so* \
43
+
libXdmcp.so* libpng16.so* libxcb*.so* libharfbuzz.so* \
44
+
libcairo.so* libfreetype.so*
45
+
ln -s ${bzip2.out}/lib/libbz2.so.1.0.6 libbz2.so.1.0
48
+
# Use our OpenJDK instead of Bitwig’s bundled—and commercial!—one.
49
+
rm -rf $out/libexec/lib/jre
50
+
ln -s ${jdk.home}/jre $out/libexec/lib/jre
52
+
# Bitwig’s `libx11-windowing-system.so` has several problems:
54
+
# • has some old version of libxkbcommon linked statically (ಠ_ಠ),
56
+
# • hardcodes path to `/usr/share/X11/xkb`,
58
+
# • even if we redirected it with libredirect (after adding
59
+
# `eaccess()` to libredirect!), their version of libxkbcommon
60
+
# is unable to parse our xkeyboardconfig. Been there, done that.
62
+
# However, it suffices to override theirs with our libxkbcommon
63
+
# in LD_PRELOAD. :-)
65
+
find $out -type f -executable \
66
+
-not -name '*.so.*' \
68
+
-not -path '*/resources/*' | \
69
+
while IFS= read -r f ; do
71
+
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
74
+
--prefix PATH : "${binPath}" \
75
+
--prefix LD_LIBRARY_PATH : "${libPath}" \
76
+
--set LD_PRELOAD "${libxkbcommon.out}/lib/libxkbcommon.so" || true
80
+
ln -s $out/libexec/bitwig-studio $out/bin/bitwig-studio
82
+
cp -r usr/share $out/share
85
+
meta = with stdenv.lib; {
86
+
description = "A digital audio workstation";
87
+
longDescription = ''
88
+
Bitwig Studio is a multi-platform music-creation system for
89
+
production, performance and DJing, with a focus on flexible
90
+
editing tools and a super-fast workflow.
92
+
homepage = http://www.bitwig.com/;
93
+
license = licenses.unfree;
94
+
platforms = [ "x86_64-linux" ];
95
+
maintainers = with maintainers; [ michalrus ];