qemu-utils: copy from qemu_kvm, not qemu

qemu_kvm is a much smaller build, so it's nicer if you're building
qemu-utils specifically.  None of the tools depend on the emulation
targets disabled in qemu_kvm.

The tools are copied, not linked, so we don't have to worry about
potentially depending on both qemu_kvm and qemu in a bigger
derivation, and qemu_kvm is already built by Hydra, so there's no
increase in Hydra workload by using the variant.
This commit is contained in:
Alyssa Ross 2023-08-23 20:54:43 +00:00 committed by Cole Helbling
parent 7ed214e1cd
commit 045910a1a3

View File

@ -1,24 +1,24 @@
{ stdenv, installShellFiles, qemu, removeReferencesTo }:
{ stdenv, installShellFiles, qemu_kvm, removeReferencesTo }:
stdenv.mkDerivation rec {
pname = "qemu-utils";
inherit (qemu) version;
inherit (qemu_kvm) version;
nativeBuildInputs = [ installShellFiles ];
buildInputs = [ qemu ];
disallowedRequisites = [ qemu ];
buildInputs = [ qemu_kvm ];
disallowedRequisites = [ qemu_kvm ];
unpackPhase = "true";
installPhase = ''
mkdir -p "$out/bin"
cp "${qemu}/bin/qemu-img" "$out/bin/qemu-img"
cp "${qemu}/bin/qemu-io" "$out/bin/qemu-io"
cp "${qemu}/bin/qemu-nbd" "$out/bin/qemu-nbd"
${removeReferencesTo}/bin/remove-references-to -t ${qemu} $out/bin/*
cp "${qemu_kvm}/bin/qemu-img" "$out/bin/qemu-img"
cp "${qemu_kvm}/bin/qemu-io" "$out/bin/qemu-io"
cp "${qemu_kvm}/bin/qemu-nbd" "$out/bin/qemu-nbd"
${removeReferencesTo}/bin/remove-references-to -t ${qemu_kvm} $out/bin/*
installManPage ${qemu}/share/man/man1/qemu-img.1.gz
installManPage ${qemu}/share/man/man8/qemu-nbd.8.gz
installManPage ${qemu_kvm}/share/man/man1/qemu-img.1.gz
installManPage ${qemu_kvm}/share/man/man8/qemu-nbd.8.gz
'';
inherit (qemu) meta;
inherit (qemu_kvm) meta;
}