2024-09-19 14:19:46 +00:00
|
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, python3Packages, zlib, pkg-config, glib, overrideSDK, buildPackages
|
|
|
|
|
, pixman, vde2, alsa-lib, flex, pcre2
|
2024-01-02 11:29:13 +00:00
|
|
|
|
, bison, lzo, snappy, libaio, libtasn1, gnutls, nettle, curl, dtc, ninja, meson
|
|
|
|
|
, sigtool
|
2023-10-09 19:29:22 +00:00
|
|
|
|
, makeWrapper, removeReferencesTo
|
2022-12-17 10:02:37 +00:00
|
|
|
|
, attr, libcap, libcap_ng, socat, libslirp
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, CoreServices, Cocoa, Hypervisor, Kernel, rez, setfile, vmnet
|
|
|
|
|
, guestAgentSupport ? (with stdenv.hostPlatform; isLinux || isNetBSD || isOpenBSD || isSunOS || isWindows) && !minimal
|
2024-09-26 11:04:55 +00:00
|
|
|
|
, numaSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32 && !minimal, numactl
|
|
|
|
|
, seccompSupport ? stdenv.hostPlatform.isLinux && !minimal, libseccomp
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, alsaSupport ? lib.hasSuffix "linux" stdenv.hostPlatform.system && !nixosTestRunner && !minimal
|
2024-09-26 11:04:55 +00:00
|
|
|
|
, pulseSupport ? !stdenv.hostPlatform.isDarwin && !nixosTestRunner && !minimal, libpulseaudio
|
|
|
|
|
, pipewireSupport ? !stdenv.hostPlatform.isDarwin && !nixosTestRunner && !minimal, pipewire
|
|
|
|
|
, sdlSupport ? !stdenv.hostPlatform.isDarwin && !nixosTestRunner && !minimal, SDL2, SDL2_image
|
|
|
|
|
, jackSupport ? !stdenv.hostPlatform.isDarwin && !nixosTestRunner && !minimal, libjack2
|
|
|
|
|
, gtkSupport ? !stdenv.hostPlatform.isDarwin && !xenSupport && !nixosTestRunner && !minimal, gtk3, gettext, vte, wrapGAppsHook3
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, vncSupport ? !nixosTestRunner && !minimal, libjpeg, libpng
|
|
|
|
|
, smartcardSupport ? !nixosTestRunner && !minimal, libcacard
|
|
|
|
|
, spiceSupport ? true && !nixosTestRunner && !minimal, spice, spice-protocol
|
|
|
|
|
, ncursesSupport ? !nixosTestRunner && !minimal, ncurses
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, usbredirSupport ? spiceSupport, usbredir
|
|
|
|
|
, xenSupport ? false, xen
|
|
|
|
|
, cephSupport ? false, ceph
|
2021-05-20 23:08:51 +00:00
|
|
|
|
, glusterfsSupport ? false, glusterfs, libuuid
|
2021-12-06 16:07:01 +00:00
|
|
|
|
, openGLSupport ? sdlSupport, mesa, libepoxy, libdrm
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, rutabagaSupport ? openGLSupport && !minimal && lib.meta.availableOn stdenv.hostPlatform rutabaga_gfx, rutabaga_gfx
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, virglSupport ? openGLSupport, virglrenderer
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, libiscsiSupport ? !minimal, libiscsi
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, smbdSupport ? false, samba
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, tpmSupport ? !minimal
|
2024-09-26 11:04:55 +00:00
|
|
|
|
, uringSupport ? stdenv.hostPlatform.isLinux && !userOnly, liburing
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, canokeySupport ? !minimal, canokey-qemu
|
|
|
|
|
, capstoneSupport ? !minimal, capstone
|
|
|
|
|
, pluginsSupport ? !stdenv.hostPlatform.isStatic
|
|
|
|
|
, enableDocs ? !minimal || toolsOnly
|
|
|
|
|
, enableTools ? !minimal || toolsOnly
|
|
|
|
|
, enableBlobs ? !minimal || toolsOnly
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, hostCpuOnly ? false
|
2023-11-16 04:20:00 +00:00
|
|
|
|
, hostCpuTargets ? (if toolsOnly
|
|
|
|
|
then [ ]
|
|
|
|
|
else if hostCpuOnly
|
2024-09-26 11:04:55 +00:00
|
|
|
|
then (lib.optional stdenv.hostPlatform.isx86_64 "i386-softmmu"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
++ ["${stdenv.hostPlatform.qemuArch}-softmmu"])
|
|
|
|
|
else null)
|
|
|
|
|
, nixosTestRunner ? false
|
2023-11-16 04:20:00 +00:00
|
|
|
|
, toolsOnly ? false
|
2024-09-19 14:19:46 +00:00
|
|
|
|
, userOnly ? false
|
|
|
|
|
, minimal ? toolsOnly || userOnly
|
2023-10-09 19:29:22 +00:00
|
|
|
|
, gitUpdater
|
2023-11-16 04:20:00 +00:00
|
|
|
|
, qemu-utils # for tests attribute
|
2020-04-24 23:36:52 +00:00
|
|
|
|
}:
|
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
|
let
|
|
|
|
|
hexagonSupport = hostCpuTargets == null || lib.elem "hexagon" hostCpuTargets;
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
|
|
buildPlatformStdenv =
|
|
|
|
|
if stdenv.buildPlatform.isDarwin then
|
|
|
|
|
overrideSDK buildPackages.stdenv {
|
|
|
|
|
# Keep these values in sync with `all-packages.nix`.
|
|
|
|
|
darwinSdkVersion = "12.3";
|
|
|
|
|
darwinMinVersion = "12.0";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
buildPackages.stdenv;
|
2023-04-29 16:46:19 +00:00
|
|
|
|
in
|
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
pname = "qemu"
|
2021-01-15 22:18:51 +00:00
|
|
|
|
+ lib.optionalString xenSupport "-xen"
|
|
|
|
|
+ lib.optionalString hostCpuOnly "-host-cpu-only"
|
2023-11-16 04:20:00 +00:00
|
|
|
|
+ lib.optionalString nixosTestRunner "-for-vm-tests"
|
2024-09-19 14:19:46 +00:00
|
|
|
|
+ lib.optionalString toolsOnly "-utils"
|
|
|
|
|
+ lib.optionalString userOnly "-user";
|
|
|
|
|
version = "9.1.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2023-10-09 19:29:22 +00:00
|
|
|
|
url = "https://download.qemu.org/qemu-${finalAttrs.version}.tar.xz";
|
2024-09-19 14:19:46 +00:00
|
|
|
|
hash = "sha256-gWtwIqi6fCrDDi4M+XPoJva8yFBTOWAyEsXt6OlNeDQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
|
depsBuildBuild = [ buildPlatformStdenv.cc ]
|
2023-04-29 16:46:19 +00:00
|
|
|
|
++ lib.optionals hexagonSupport [ pkg-config ];
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
|
nativeBuildInputs = [
|
|
|
|
|
makeWrapper removeReferencesTo
|
2024-09-19 14:19:46 +00:00
|
|
|
|
pkg-config flex bison meson ninja
|
2023-02-16 17:41:37 +00:00
|
|
|
|
|
|
|
|
|
# Don't change this to python3 and python3.pkgs.*, breaks cross-compilation
|
2024-09-19 14:19:46 +00:00
|
|
|
|
python3Packages.python
|
2023-02-16 17:41:37 +00:00
|
|
|
|
]
|
2024-05-15 15:35:15 +00:00
|
|
|
|
++ lib.optionals gtkSupport [ wrapGAppsHook3 ]
|
2024-09-19 14:19:46 +00:00
|
|
|
|
++ lib.optionals enableDocs [ python3Packages.sphinx python3Packages.sphinx-rtd-theme ]
|
2023-04-29 16:46:19 +00:00
|
|
|
|
++ lib.optionals hexagonSupport [ glib ]
|
2024-09-26 11:04:55 +00:00
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ]
|
2024-09-19 14:19:46 +00:00
|
|
|
|
++ lib.optionals (!userOnly) [ dtc ];
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
|
buildInputs = [ glib zlib ]
|
|
|
|
|
++ lib.optionals (!minimal) [ dtc pixman vde2 lzo snappy libtasn1 gnutls nettle libslirp ]
|
|
|
|
|
++ lib.optionals (!userOnly) [ curl ]
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optionals ncursesSupport [ ncurses ]
|
2024-09-26 11:04:55 +00:00
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices Cocoa Hypervisor Kernel rez setfile vmnet ]
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optionals seccompSupport [ libseccomp ]
|
|
|
|
|
++ lib.optionals numaSupport [ numactl ]
|
2021-12-06 16:07:01 +00:00
|
|
|
|
++ lib.optionals alsaSupport [ alsa-lib ]
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optionals pulseSupport [ libpulseaudio ]
|
2023-10-09 19:29:22 +00:00
|
|
|
|
++ lib.optionals pipewireSupport [ pipewire ]
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optionals sdlSupport [ SDL2 SDL2_image ]
|
2022-01-03 16:56:52 +00:00
|
|
|
|
++ lib.optionals jackSupport [ libjack2 ]
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optionals gtkSupport [ gtk3 gettext vte ]
|
|
|
|
|
++ lib.optionals vncSupport [ libjpeg libpng ]
|
|
|
|
|
++ lib.optionals smartcardSupport [ libcacard ]
|
|
|
|
|
++ lib.optionals spiceSupport [ spice-protocol spice ]
|
|
|
|
|
++ lib.optionals usbredirSupport [ usbredir ]
|
2024-10-04 16:56:33 +00:00
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.isLinux && !userOnly) [ libcap_ng libcap attr libaio ]
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optionals xenSupport [ xen ]
|
|
|
|
|
++ lib.optionals cephSupport [ ceph ]
|
|
|
|
|
++ lib.optionals glusterfsSupport [ glusterfs libuuid ]
|
2021-12-06 16:07:01 +00:00
|
|
|
|
++ lib.optionals openGLSupport [ mesa libepoxy libdrm ]
|
2024-01-13 08:15:51 +00:00
|
|
|
|
++ lib.optionals rutabagaSupport [ rutabaga_gfx ]
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optionals virglSupport [ virglrenderer ]
|
|
|
|
|
++ lib.optionals libiscsiSupport [ libiscsi ]
|
2021-12-06 16:07:01 +00:00
|
|
|
|
++ lib.optionals smbdSupport [ samba ]
|
2022-10-06 18:32:54 +00:00
|
|
|
|
++ lib.optionals uringSupport [ liburing ]
|
2023-05-24 13:37:59 +00:00
|
|
|
|
++ lib.optionals canokeySupport [ canokey-qemu ]
|
2024-10-04 16:56:33 +00:00
|
|
|
|
++ lib.optionals capstoneSupport [ capstone ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
|
dontUseMesonConfigure = true; # meson's configurePhase isn't compatible with qemu build
|
2024-09-19 14:19:46 +00:00
|
|
|
|
dontAddStaticConfigureFlags = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
|
outputs = [ "out" ] ++ lib.optional guestAgentSupport "ga";
|
2021-12-26 17:43:05 +00:00
|
|
|
|
# On aarch64-linux we would shoot over the Hydra's 2G output limit.
|
2024-09-26 11:04:55 +00:00
|
|
|
|
separateDebugInfo = !(stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
|
./fix-qemu-ga.patch
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
|
# Workaround for upstream issue with nested virtualisation: https://gitlab.com/qemu-project/qemu/-/issues/1008
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
url = "https://gitlab.com/qemu-project/qemu/-/commit/3e4546d5bd38a1e98d4bd2de48631abf0398a3a2.diff";
|
|
|
|
|
sha256 = "sha256-oC+bRjEHixv1QEFO9XAm4HHOwoiT+NkhknKGPydnZ5E=";
|
|
|
|
|
revert = true;
|
|
|
|
|
})
|
2022-03-10 19:12:11 +00:00
|
|
|
|
]
|
2022-07-18 16:21:45 +00:00
|
|
|
|
++ lib.optional nixosTestRunner ./force-uid0-on-9p.patch;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
|
postPatch = ''
|
2021-05-28 09:39:13 +00:00
|
|
|
|
# Otherwise tries to ensure /var/run exists.
|
2022-12-17 10:02:37 +00:00
|
|
|
|
sed -i "/install_emptydir(get_option('localstatedir') \/ 'run')/d" \
|
2021-03-20 04:20:00 +00:00
|
|
|
|
qga/meson.build
|
|
|
|
|
'';
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
preConfigure = ''
|
|
|
|
|
unset CPP # intereferes with dependency calculation
|
2021-02-05 17:12:51 +00:00
|
|
|
|
# this script isn't marked as executable b/c it's indirectly used by meson. Needed to patch its shebang
|
2023-04-12 12:48:02 +00:00
|
|
|
|
chmod +x ./scripts/shaderinclude.py
|
2021-02-05 17:12:51 +00:00
|
|
|
|
patchShebangs .
|
2021-02-16 17:04:54 +00:00
|
|
|
|
# avoid conflicts with libc++ include for <version>
|
|
|
|
|
mv VERSION QEMU_VERSION
|
2021-05-03 20:48:10 +00:00
|
|
|
|
substituteInPlace configure \
|
|
|
|
|
--replace '$source_path/VERSION' '$source_path/QEMU_VERSION'
|
2021-02-16 17:04:54 +00:00
|
|
|
|
substituteInPlace meson.build \
|
|
|
|
|
--replace "'VERSION'" "'QEMU_VERSION'"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
|
configureFlags = [
|
2021-12-26 17:43:05 +00:00
|
|
|
|
"--disable-strip" # We'll strip ourselves after separating debug info.
|
2023-04-29 16:46:19 +00:00
|
|
|
|
(lib.enableFeature enableDocs "docs")
|
2024-09-19 14:19:46 +00:00
|
|
|
|
(lib.enableFeature enableTools "tools")
|
2021-08-05 21:33:18 +00:00
|
|
|
|
"--localstatedir=/var"
|
|
|
|
|
"--sysconfdir=/etc"
|
2022-01-03 16:56:52 +00:00
|
|
|
|
"--cross-prefix=${stdenv.cc.targetPrefix}"
|
2022-04-27 09:35:20 +00:00
|
|
|
|
(lib.enableFeature guestAgentSupport "guest-agent")
|
2021-08-05 21:33:18 +00:00
|
|
|
|
] ++ lib.optional numaSupport "--enable-numa"
|
|
|
|
|
++ lib.optional seccompSupport "--enable-seccomp"
|
|
|
|
|
++ lib.optional smartcardSupport "--enable-smartcard"
|
|
|
|
|
++ lib.optional spiceSupport "--enable-spice"
|
|
|
|
|
++ lib.optional usbredirSupport "--enable-usb-redir"
|
|
|
|
|
++ lib.optional (hostCpuTargets != null) "--target-list=${lib.concatStringsSep "," hostCpuTargets}"
|
2024-09-26 11:04:55 +00:00
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ "--enable-cocoa" "--enable-hvf" ]
|
|
|
|
|
++ lib.optional (stdenv.hostPlatform.isLinux && !userOnly) "--enable-linux-aio"
|
2021-08-05 21:33:18 +00:00
|
|
|
|
++ lib.optional gtkSupport "--enable-gtk"
|
|
|
|
|
++ lib.optional xenSupport "--enable-xen"
|
|
|
|
|
++ lib.optional cephSupport "--enable-rbd"
|
|
|
|
|
++ lib.optional glusterfsSupport "--enable-glusterfs"
|
|
|
|
|
++ lib.optional openGLSupport "--enable-opengl"
|
|
|
|
|
++ lib.optional virglSupport "--enable-virglrenderer"
|
|
|
|
|
++ lib.optional tpmSupport "--enable-tpm"
|
|
|
|
|
++ lib.optional libiscsiSupport "--enable-libiscsi"
|
2021-12-06 16:07:01 +00:00
|
|
|
|
++ lib.optional smbdSupport "--smbd=${samba}/bin/smbd"
|
2022-10-06 18:32:54 +00:00
|
|
|
|
++ lib.optional uringSupport "--enable-linux-io-uring"
|
2023-05-24 13:37:59 +00:00
|
|
|
|
++ lib.optional canokeySupport "--enable-canokey"
|
2024-09-19 14:19:46 +00:00
|
|
|
|
++ lib.optional capstoneSupport "--enable-capstone"
|
|
|
|
|
++ lib.optional (!pluginsSupport) "--disable-plugins"
|
|
|
|
|
++ lib.optional (!enableBlobs) "--disable-install-blobs"
|
|
|
|
|
++ lib.optional userOnly "--disable-system"
|
|
|
|
|
++ lib.optional stdenv.hostPlatform.isStatic "--static";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
|
dontWrapGApps = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
|
# QEMU attaches entitlements with codesign and strip removes those,
|
|
|
|
|
# voiding the entitlements and making it non-operational.
|
|
|
|
|
# The alternative is to re-sign with entitlements after stripping:
|
|
|
|
|
# * https://github.com/qemu/qemu/blob/v6.1.0/scripts/entitlement.sh#L25
|
2024-09-26 11:04:55 +00:00
|
|
|
|
dontStrip = stdenv.hostPlatform.isDarwin;
|
2021-10-01 09:20:50 +00:00
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
|
postFixup = ''
|
2020-08-20 17:08:02 +00:00
|
|
|
|
# the .desktop is both invalid and pointless
|
2021-03-09 03:18:52 +00:00
|
|
|
|
rm -f $out/share/applications/qemu.desktop
|
2022-04-27 09:35:20 +00:00
|
|
|
|
'' + lib.optionalString guestAgentSupport ''
|
2022-04-15 01:41:22 +00:00
|
|
|
|
# move qemu-ga (guest agent) to separate output
|
2020-08-20 17:08:02 +00:00
|
|
|
|
mkdir -p $ga/bin
|
2022-04-15 01:41:22 +00:00
|
|
|
|
mv $out/bin/qemu-ga $ga/bin/
|
|
|
|
|
ln -s $ga/bin/qemu-ga $out/bin
|
2022-03-05 16:20:37 +00:00
|
|
|
|
remove-references-to -t $out $ga/bin/qemu-ga
|
2021-08-05 21:33:18 +00:00
|
|
|
|
'' + lib.optionalString gtkSupport ''
|
2020-08-20 17:08:02 +00:00
|
|
|
|
# wrap GTK Binaries
|
|
|
|
|
for f in $out/bin/qemu-system-*; do
|
|
|
|
|
wrapGApp $f
|
|
|
|
|
done
|
2024-09-19 14:19:46 +00:00
|
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
|
|
|
# HACK: Otherwise the result will have the entire buildInputs closure
|
|
|
|
|
# injected by the pkgsStatic stdenv
|
|
|
|
|
# <https://github.com/NixOS/nixpkgs/issues/83667>
|
|
|
|
|
rm -f $out/nix-support/propagated-build-inputs
|
2020-08-20 17:08:02 +00:00
|
|
|
|
'';
|
2021-02-05 17:12:51 +00:00
|
|
|
|
preBuild = "cd build";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
|
# tests can still timeout on slower systems
|
2023-10-09 19:29:22 +00:00
|
|
|
|
doCheck = false;
|
2023-02-02 18:25:31 +00:00
|
|
|
|
nativeCheckInputs = [ socat ];
|
2022-02-20 05:27:41 +00:00
|
|
|
|
preCheck = ''
|
|
|
|
|
# time limits are a little meagre for a build machine that's
|
|
|
|
|
# potentially under load.
|
|
|
|
|
substituteInPlace ../tests/unit/meson.build \
|
|
|
|
|
--replace 'timeout: slow_tests' 'timeout: 50 * slow_tests'
|
|
|
|
|
substituteInPlace ../tests/qtest/meson.build \
|
|
|
|
|
--replace 'timeout: slow_qtests' 'timeout: 50 * slow_qtests'
|
|
|
|
|
substituteInPlace ../tests/fp/meson.build \
|
|
|
|
|
--replace 'timeout: 90)' 'timeout: 300)'
|
|
|
|
|
|
|
|
|
|
# point tests towards correct binaries
|
|
|
|
|
substituteInPlace ../tests/unit/test-qga.c \
|
2023-10-09 19:29:22 +00:00
|
|
|
|
--replace '/bin/bash' "$(type -P bash)" \
|
2022-02-20 05:27:41 +00:00
|
|
|
|
--replace '/bin/echo' "$(type -P echo)"
|
|
|
|
|
substituteInPlace ../tests/unit/test-io-channel-command.c \
|
|
|
|
|
--replace '/bin/socat' "$(type -P socat)"
|
|
|
|
|
|
|
|
|
|
# combined with a long package name, some temp socket paths
|
|
|
|
|
# can end up exceeding max socket name len
|
|
|
|
|
substituteInPlace ../tests/qtest/bios-tables-test.c \
|
|
|
|
|
--replace 'qemu-test_acpi_%s_tcg_%s' '%s_%s'
|
|
|
|
|
|
|
|
|
|
# get-fsinfo attempts to access block devices, disallowed by sandbox
|
|
|
|
|
sed -i -e '/\/qga\/get-fsinfo/d' -e '/\/qga\/blacklist/d' \
|
|
|
|
|
../tests/unit/test-qga.c
|
2024-06-20 14:57:18 +00:00
|
|
|
|
|
|
|
|
|
# xattrs are not allowed in the sandbox
|
|
|
|
|
substituteInPlace ../tests/qtest/virtio-9p-test.c \
|
|
|
|
|
--replace-fail mapped-xattr mapped-file
|
2024-09-26 11:04:55 +00:00
|
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2022-02-20 05:27:41 +00:00
|
|
|
|
# skip test that stalls on darwin, perhaps due to subtle differences
|
|
|
|
|
# in fifo behaviour
|
|
|
|
|
substituteInPlace ../tests/unit/meson.build \
|
|
|
|
|
--replace "'test-io-channel-command'" "#'test-io-channel-command'"
|
|
|
|
|
'';
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
# Add a ‘qemu-kvm’ wrapper for compatibility/convenience.
|
2024-09-19 14:19:46 +00:00
|
|
|
|
postInstall = lib.optionalString (!minimal) ''
|
2022-02-10 20:34:41 +00:00
|
|
|
|
ln -s $out/bin/qemu-system-${stdenv.hostPlatform.qemuArch} $out/bin/qemu-kvm
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
|
qemu-system-i386 = "bin/qemu-system-i386";
|
2023-11-16 04:20:00 +00:00
|
|
|
|
tests = lib.optionalAttrs (!toolsOnly) {
|
2023-10-09 19:29:22 +00:00
|
|
|
|
qemu-tests = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; });
|
2023-11-16 04:20:00 +00:00
|
|
|
|
qemu-utils-builds = qemu-utils;
|
2023-10-09 19:29:22 +00:00
|
|
|
|
};
|
|
|
|
|
updateScript = gitUpdater {
|
|
|
|
|
# No nicer place to find latest release.
|
|
|
|
|
url = "https://gitlab.com/qemu-project/qemu.git";
|
|
|
|
|
rev-prefix = "v";
|
|
|
|
|
ignoredVersions = "(alpha|beta|rc).*";
|
2022-02-20 05:27:41 +00:00
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-04-26 19:14:03 +00:00
|
|
|
|
# Builds in ~3h with 2 cores, and ~20m with a big-parallel builder.
|
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
|
meta = with lib; {
|
2023-11-16 04:20:00 +00:00
|
|
|
|
homepage = "https://www.qemu.org/";
|
2024-06-20 14:57:18 +00:00
|
|
|
|
description = "Generic and open source machine emulator and virtualizer";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
license = licenses.gpl2Plus;
|
2024-09-19 14:19:46 +00:00
|
|
|
|
maintainers = with maintainers; [ qyliss ] ++ lib.optionals xenSupport xen.meta.maintainers;
|
2021-05-03 20:48:10 +00:00
|
|
|
|
platforms = platforms.unix;
|
2023-11-16 04:20:00 +00:00
|
|
|
|
}
|
|
|
|
|
# toolsOnly: Does not have qemu-kvm and there's no main support tool
|
2024-09-19 14:19:46 +00:00
|
|
|
|
# userOnly: There's one qemu-<arch> for every architecture
|
|
|
|
|
// lib.optionalAttrs (!toolsOnly && !userOnly) {
|
2023-11-16 04:20:00 +00:00
|
|
|
|
mainProgram = "qemu-kvm";
|
2024-09-19 14:19:46 +00:00
|
|
|
|
}
|
|
|
|
|
# userOnly: https://qemu.readthedocs.io/en/v9.0.2/user/main.html
|
|
|
|
|
// lib.optionalAttrs userOnly {
|
|
|
|
|
platforms = with platforms; (linux ++ freebsd ++ openbsd ++ netbsd);
|
|
|
|
|
description = "QEMU User space emulator - launch executables compiled for one CPU on another CPU";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
|
})
|