Skip to content

Commit

Permalink
qemu: wrap GTK binaries
Browse files Browse the repository at this point in the history
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
  • Loading branch information
flokli committed Jun 1, 2020
1 parent 89fda74 commit c7eb16c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkgs/applications/virtualization/qemu/default.nix
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit c7eb16c

Please sign in to comment.