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