qemu: fix qemu.ga including qemu in it's closure

The qemu-ga binary is already moved to a separate
output but still depends on qemu, adding about
600MiB to it's closure.

The command "strings qemu-ga" reveals that something
like

/nix/store/bqgpvv5qrpb741swczqk3lrdm5gzaqx2-qemu-host-cpu-only-6.2.0/bin

is contained, causing this false positive. So use
remove-references-to to reduce the closure to about
600KiB.
This commit is contained in:
Matthias Treydte 2022-03-02 11:00:10 +01:00 committed by Alyssa Ross
parent 51ceca24be
commit 38cf6fea69

View file

@ -1,7 +1,7 @@
{ lib, stdenv, fetchurl, fetchpatch, python3, python3Packages, zlib, pkg-config, glib, buildPackages
, perl, pixman, vde2, alsa-lib, texinfo, flex
, bison, lzo, snappy, libaio, libtasn1, gnutls, nettle, curl, ninja, meson, sigtool
, makeWrapper, runtimeShell
, makeWrapper, runtimeShell, removeReferencesTo
, attr, libcap, libcap_ng, socat
, CoreServices, Cocoa, Hypervisor, rez, setfile
, numaSupport ? stdenv.isLinux && !stdenv.isAarch32, numactl
@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ makeWrapper pkg-config flex bison meson ninja perl python3 python3Packages.sphinx python3Packages.sphinx_rtd_theme ]
nativeBuildInputs = [ makeWrapper removeReferencesTo pkg-config flex bison meson ninja perl python3 python3Packages.sphinx python3Packages.sphinx_rtd_theme ]
++ lib.optionals gtkSupport [ wrapGAppsHook ]
++ lib.optionals stdenv.isDarwin [ sigtool ];
@ -175,6 +175,7 @@ stdenv.mkDerivation rec {
# copy qemu-ga (guest agent) to separate output
mkdir -p $ga/bin
cp $out/bin/qemu-ga $ga/bin/
remove-references-to -t $out $ga/bin/qemu-ga
'' + lib.optionalString gtkSupport ''
# wrap GTK Binaries
for f in $out/bin/qemu-system-*; do