Package override made to reproduce succesful package build makes a different derivation

I have the following package which is just pkgs.bitwig-studio5-unwrapped with the version changed to 6.0 and yabridge, fontconfig added into buildInputs to be able to use plugins. If i run this package by running ~/result/bin/bitwig-studio it works and i can use windows plugins through yabridge (which i cannot using the regular bitwig-studio package because it doesn`t find libyabridge.vst3.so).

{
stdenv,
fetchurl,
alsa-lib,
atk,
cairo,
dpkg,
ffmpeg,
freetype,
gdk-pixbuf,
glib,
gtk3,
harfbuzz,
lcms,
lib,
libglvnd,
libjack2,
libjpeg,
libnghttp2,
libudev-zero,
libxkbcommon,
makeWrapper,
pango,
pipewire,
vulkan-loader,
wrapGAppsHook3,
xcb-imdkit,
xdg-utils,
xorg,
zlib,
yabridge,
fontconfig,

}:

stdenv.mkDerivation rec {
pname = “bitwig-studio-unwrapped”;
version = “6.0”;

src = fetchurl {
name = “bitwig-studio-${version}.deb”;
url = “https://www.bitwig.com/dl/Bitwig%20Studio/${version}/installer_linux/”;
hash = “sha256-jrCTgaxfeWhfKwLeKLmqTQWS7RVbVnHqJ0InCipmm8k=”;
};

nativeBuildInputs = [
dpkg
makeWrapper
wrapGAppsHook3
];

dontBuild = true;
dontWrapGApps = true; # we only want $gappsWrapperArgs here

buildInputs = [
alsa-lib
atk
cairo
freetype
gdk-pixbuf
glib
gtk3
harfbuzz
lcms
libglvnd
libjack2

libjpeg8 is required for converting jpeg’s to colour palettes

libjpeg
libnghttp2
xorg.libxcb
xorg.libXcursor
xorg.libX11
xorg.libXtst
libxkbcommon
libudev-zero
pango
pipewire
(lib.getLib stdenv.cc.cc)
vulkan-loader
xcb-imdkit
xorg.xcbutil
xorg.xcbutilwm
zlib**
yabridge
fontconfig**
];

installPhase = ‘’
runHook preInstall

mkdir -p $out/bin
cp -r opt/bitwig-studio $out/libexec
ln -s $out/libexec/bitwig-studio $out/bin/bitwig-studio
cp -r usr/share $out/share

# Bitwig includes a copy of libxcb-imdkit.
# Removing it will force it to use our version.
rm $out/libexec/lib/bitwig-studio/libxcb-imdkit.so.1

substitute usr/share/applications/com.bitwig.BitwigStudio.desktop \
  $out/share/applications/com.bitwig.BitwigStudio.desktop \
  --replace-fail "Exec=bitwig-studio" "Exec=$out/bin/bitwig-studio"

  runHook postInstall

‘’;

postFixup = ‘’

patchelf fails to set rpath on BitwigStudioEngine, so we use

the LD_LIBRARY_PATH way

find $out -type f -executable \
  -not -name '*.so.*' \
  -not -name '*.so' \
  -not -name '*.jar' \
  -not -name 'jspawnhelper' \
  -not -path '*/resources/*' | \
while IFS= read -r f ; do
  patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $f
  # make xdg-open overrideable at runtime
  wrapProgram $f \
    "''${gappsWrapperArgs[@]}" \
    --prefix PATH : "${lib.makeBinPath [ ffmpeg ]}" \
    --suffix PATH : "${lib.makeBinPath [ xdg-utils ]}" \
    --suffix LD_LIBRARY_PATH : "${lib.strings.makeLibraryPath buildInputs}"
done

find $out -type f -executable -name 'jspawnhelper' | \
while IFS= read -r f ; do
  patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $f
done

‘’;
}

I’ve made the following override which should produce the same derivation:

(pkgs.bitwig-studio5-unwrapped.overrideAttrs (oldAttrs: rec{
version = “6.0”;
src = pkgs.fetchurl {
name = “bitwig-studio-${version}.deb”;
url = “https://www.bitwig.com/dl/Bitwig%20Studio/${version}/installer_linux/”;
hash = “sha256-jrCTgaxfeWhfKwLeKLmqTQWS7RVbVnHqJ0InCipmm8k=”;
};
buildInputs = oldAttrs.buildInputs ++ [pkgs.yabridge pkgs.fontconfig];
}))

But when trying to use windows plugins on this one, i get “libyabridge.vst3.so not found”. What is the problem here? is my override missing something or is it something to do with the nixos filesystem?