nixpkgs/pkgs/applications/virtualization/qemu/utils.nix
Alyssa Ross 045910a1a3 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.
2023-08-24 07:15:13 -07:00

25 lines
721 B
Nix

{ stdenv, installShellFiles, qemu_kvm, removeReferencesTo }:
stdenv.mkDerivation rec {
pname = "qemu-utils";
inherit (qemu_kvm) version;
nativeBuildInputs = [ installShellFiles ];
buildInputs = [ qemu_kvm ];
disallowedRequisites = [ qemu_kvm ];
unpackPhase = "true";
installPhase = ''
mkdir -p "$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_kvm}/share/man/man1/qemu-img.1.gz
installManPage ${qemu_kvm}/share/man/man8/qemu-nbd.8.gz
'';
inherit (qemu_kvm) meta;
}