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