qemu: wrap GTK binaries

Applications using a different GTK version than the user session don't
work well, and people often run NixOS VM tests on different channels.

Wrapping these GTK binaries is a common way to fix this.

Fixes #69158
This commit is contained in:
Florian Klink 2020-06-01 22:56:37 +02:00
parent 89fda74df5
commit c7eb16cec3

View File

@ -8,7 +8,7 @@
, seccompSupport ? stdenv.isLinux, libseccomp , seccompSupport ? stdenv.isLinux, libseccomp
, pulseSupport ? !stdenv.isDarwin, libpulseaudio , pulseSupport ? !stdenv.isDarwin, libpulseaudio
, sdlSupport ? !stdenv.isDarwin, SDL2 , sdlSupport ? !stdenv.isDarwin, SDL2
, gtkSupport ? !stdenv.isDarwin && !xenSupport, gtk3, gettext, vte , gtkSupport ? !stdenv.isDarwin && !xenSupport, gtk3, gettext, vte, wrapGAppsHook
, vncSupport ? true, libjpeg, libpng , vncSupport ? true, libjpeg, libpng
, smartcardSupport ? true, libcacard , smartcardSupport ? true, libcacard
, spiceSupport ? !stdenv.isDarwin, spice, spice-protocol , spiceSupport ? !stdenv.isDarwin, spice, spice-protocol
@ -46,7 +46,8 @@ stdenv.mkDerivation rec {
sha256 = "1gczv8hn3wqci86css3mhzrppp3z8vppxw25l08j589k6bvz7x1w"; sha256 = "1gczv8hn3wqci86css3mhzrppp3z8vppxw25l08j589k6bvz7x1w";
}; };
nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ]; nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ]
++ optionals gtkSupport [ wrapGAppsHook ];
buildInputs = buildInputs =
[ zlib glib ncurses perl pixman [ zlib glib ncurses perl pixman
vde2 texinfo makeWrapper lzo snappy vde2 texinfo makeWrapper lzo snappy
@ -165,12 +166,17 @@ stdenv.mkDerivation rec {
++ optional smbdSupport "--smbd=${samba}/bin/smbd"; ++ optional smbdSupport "--smbd=${samba}/bin/smbd";
doCheck = false; # tries to access /dev doCheck = false; # tries to access /dev
dontWrapGApps = true;
postFixup = postFixup = ''
''
# copy qemu-ga (guest agent) to separate output # copy qemu-ga (guest agent) to separate output
mkdir -p $ga/bin mkdir -p $ga/bin
cp $out/bin/qemu-ga $ga/bin/ cp $out/bin/qemu-ga $ga/bin/
'' + optionalString gtkSupport ''
# wrap GTK Binaries
for f in $out/bin/qemu-system-*; do
wrapGApp $f
done
''; '';
# Add a qemu-kvm wrapper for compatibility/convenience. # Add a qemu-kvm wrapper for compatibility/convenience.