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