1{
2 stdenv,
3 fetchurl,
4 alsa-lib,
5 cairo,
6 dpkg,
7 freetype,
8 gdk-pixbuf,
9 glib,
10 gtk3,
11 lib,
12 xorg,
13 libglvnd,
14 libjack2,
15 ffmpeg,
16 libxkbcommon,
17 xdg-utils,
18 zlib,
19 pulseaudio,
20 wrapGAppsHook3,
21 makeWrapper,
22}:
23
24stdenv.mkDerivation rec {
25 pname = "bitwig-studio";
26 version = "3.3.11";
27
28 src = fetchurl {
29 url = "https://downloads.bitwig.com/stable/${version}/${pname}-${version}.deb";
30 sha256 = "sha256-cF8gVPjM0KUcKOW09uFccp4/lzbUmZcBkVOwr/A/8Yw=";
31 };
32
33 nativeBuildInputs = [
34 dpkg
35 makeWrapper
36 wrapGAppsHook3
37 ];
38
39 dontBuild = true;
40 dontWrapGApps = true; # we only want $gappsWrapperArgs here
41
42 buildInputs = with xorg; [
43 alsa-lib
44 cairo
45 freetype
46 gdk-pixbuf
47 glib
48 gtk3
49 libxcb
50 xcbutil
51 xcbutilwm
52 zlib
53 libXtst
54 libxkbcommon
55 pulseaudio
56 libjack2
57 libX11
58 libglvnd
59 libXcursor
60 (lib.getLib stdenv.cc.cc)
61 ];
62
63 ldLibraryPath = lib.strings.makeLibraryPath buildInputs;
64
65 installPhase = ''
66 runHook preInstall
67
68 mkdir -p $out/bin
69 cp -r opt/bitwig-studio $out/libexec
70 ln -s $out/libexec/bitwig-studio $out/bin/bitwig-studio
71 cp -r usr/share $out/share
72
73 runHook postInstall
74 '';
75
76 postFixup = ''
77 # patchelf fails to set rpath on BitwigStudioEngine, so we use
78 # the LD_LIBRARY_PATH way
79
80 find $out -type f -executable \
81 -not -name '*.so.*' \
82 -not -name '*.so' \
83 -not -name '*.jar' \
84 -not -path '*/resources/*' | \
85 while IFS= read -r f ; do
86 patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $f
87 wrapProgram $f \
88 "''${gappsWrapperArgs[@]}" \
89 --prefix LD_LIBRARY_PATH : "${ldLibraryPath}" \
90 --prefix PATH : "${lib.makeBinPath [ ffmpeg ]}" \
91 --suffix PATH : "${lib.makeBinPath [ xdg-utils ]}"
92 done
93 '';
94
95 meta = with lib; {
96 description = "Digital audio workstation";
97 longDescription = ''
98 Bitwig Studio is a multi-platform music-creation system for
99 production, performance and DJing, with a focus on flexible
100 editing tools and a super-fast workflow.
101 '';
102 homepage = "https://www.bitwig.com/";
103 license = licenses.unfree;
104 platforms = [ "x86_64-linux" ];
105 maintainers = with maintainers; [
106 bfortz
107 michalrus
108 mrVanDalo
109 ];
110 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
111 };
112}