From c7eb16cec3c7d00ed77a637a702c98a322d7ab85 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 1 Jun 2020 22:56:37 +0200 Subject: [PATCH] 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 --- pkgs/applications/virtualization/qemu/default.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index d6611e20a9c1..5e1798c8ec98 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -8,7 +8,7 @@ , seccompSupport ? stdenv.isLinux, libseccomp , pulseSupport ? !stdenv.isDarwin, libpulseaudio , sdlSupport ? !stdenv.isDarwin, SDL2 -, gtkSupport ? !stdenv.isDarwin && !xenSupport, gtk3, gettext, vte +, gtkSupport ? !stdenv.isDarwin && !xenSupport, gtk3, gettext, vte, wrapGAppsHook , vncSupport ? true, libjpeg, libpng , smartcardSupport ? true, libcacard , spiceSupport ? !stdenv.isDarwin, spice, spice-protocol @@ -46,7 +46,8 @@ stdenv.mkDerivation rec { sha256 = "1gczv8hn3wqci86css3mhzrppp3z8vppxw25l08j589k6bvz7x1w"; }; - nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ]; + nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ] + ++ optionals gtkSupport [ wrapGAppsHook ]; buildInputs = [ zlib glib ncurses perl pixman vde2 texinfo makeWrapper lzo snappy @@ -165,12 +166,17 @@ stdenv.mkDerivation rec { ++ optional smbdSupport "--smbd=${samba}/bin/smbd"; doCheck = false; # tries to access /dev + dontWrapGApps = true; - postFixup = - '' + postFixup = '' # copy qemu-ga (guest agent) to separate output mkdir -p $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.