From d584a8bb0d54fa041654481bd264ac934b4b5e49 Mon Sep 17 00:00:00 2001 From: Yarny0 <41838844+Yarny0@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:56:52 +0100 Subject: [PATCH] virtualbox: fix X11 shared clipboard Since the update to version 7.1.4, clipboard sharing is broken if the host runs in X11. The exact preconditions to trigger the bug are still unclear to me: It can reliably be reproduced if the host runs within a plasma5 desktop environemnt, while the bug does not occur in an Xfce environment. The guest OS doesn't seem to matter (tested with Windows 11 and NixOS). Corresponding log messages (virtualbox machine log) are: > Shared Clipboard: Initializing X11 clipboard (regular mode) > Shared Clipboard: libxFixes.so.* not found! > Shared Clipboard: Failed to load the XFIXES extension > Shared Clipboard: Initialisation failed: VERR_NOT_SUPPORTED > Shared Clipboard: X11 event thread reported an error while starting The underlying problem here is that virtualbox dlopens `libXfixes.so.*` which is not in the RPATH: https://github.com/mirror/vbox/blob/74117a1cb257c00e2a92cf522e8e930bd1c4d64b/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp#L961 To fix the issue, the commit at hand does what has already been done for other libraries (like `libpulse` or `libasound`): The full path to the library is patched into the dlopen call. --- pkgs/applications/virtualization/virtualbox/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index e734319a7a19..be348027945a 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -14,6 +14,7 @@ xorgproto, libXext, libXcursor, + libXfixes, libXmu, libIDL, SDL2, @@ -204,6 +205,9 @@ stdenv.mkDerivation (finalAttrs: { grep 'libdbus-1\.so\.3' src include -rI --files-with-match | xargs sed -i -e ' s@"libdbus-1\.so\.3"@"${dbus.lib}/lib/libdbus-1.so.3"@g' + grep 'libXfixes\.so\.3' src include -rI --files-with-match | xargs sed -i -e ' + s@"libXfixes\.so\.3"@"${libXfixes.out}/lib/libXfixes.so.3"@g' + grep 'libasound\.so\.2' src include -rI --files-with-match | xargs sed -i -e ' s@"libasound\.so\.2"@"${alsa-lib.out}/lib/libasound.so.2"@g'