aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/applications/virtualization/qemu/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/virtualization/qemu/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/virtualization/qemu/default.nix75
1 files changed, 25 insertions, 50 deletions
diff --git a/nixpkgs/pkgs/applications/virtualization/qemu/default.nix b/nixpkgs/pkgs/applications/virtualization/qemu/default.nix
index d6611e20a9c..535f8371153 100644
--- a/nixpkgs/pkgs/applications/virtualization/qemu/default.nix
+++ b/nixpkgs/pkgs/applications/virtualization/qemu/default.nix
@@ -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
@@ -18,6 +18,7 @@
, openGLSupport ? sdlSupport, mesa, epoxy, libdrm
, virglSupport ? openGLSupport, virglrenderer
, smbdSupport ? false, samba
+, tpmSupport ? true
, hostCpuOnly ? false
, hostCpuTargets ? (if hostCpuOnly
then (stdenv.lib.optional stdenv.isx86_64 "i386-softmmu"
@@ -35,18 +36,19 @@ let
in
stdenv.mkDerivation rec {
- version = "4.2.0";
+ version = "5.1.0";
pname = "qemu"
+ stdenv.lib.optionalString xenSupport "-xen"
+ stdenv.lib.optionalString hostCpuOnly "-host-cpu-only"
+ stdenv.lib.optionalString nixosTestRunner "-for-vm-tests";
src = fetchurl {
- url = "https://wiki.qemu.org/download/qemu-${version}.tar.bz2";
- sha256 = "1gczv8hn3wqci86css3mhzrppp3z8vppxw25l08j589k6bvz7x1w";
+ url= "https://download.qemu.org/qemu-${version}.tar.xz";
+ sha256 = "1rd41wwlvp0vpialjp2czs6i3lsc338xc72l3zkbb7ixjfslw5y9";
};
- 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
@@ -77,44 +79,6 @@ stdenv.mkDerivation rec {
./no-etc-install.patch
./fix-qemu-ga.patch
./9p-ignore-noatime.patch
- (fetchpatch {
- name = "CVE-2019-15890.patch";
- url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=c59279437eda91841b9d26079c70b8a540d41204";
- sha256 = "1q2rc67mfdz034mk81z9bw105x9zad7n954sy3kq068b1svrf7iy";
- stripLen = 1;
- extraPrefix = "slirp/";
- })
- # patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7039
- (fetchpatch {
- name = "CVE-2020-7039-1.patch";
- url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=2655fffed7a9e765bcb4701dd876e9dab975f289";
- sha256 = "1jh0k3lg3553c2x1kq1kl3967jabhba5gm584wjpmr5mjqk3lnz1";
- stripLen = 1;
- extraPrefix = "slirp/";
- excludes = ["slirp/CHANGELOG.md"];
- })
- (fetchpatch {
- name = "CVE-2020-7039-2.patch";
- url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=82ebe9c370a0e2970fb5695aa19aa5214a6a1c80";
- sha256 = "08ccxcmrhzknnzd1a1q2brszv3a7h02n26r73kpli10b0hn12r2l";
- stripLen = 1;
- extraPrefix = "slirp/";
- })
- (fetchpatch {
- name = "CVE-2020-7039-3.patch";
- url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=ce131029d6d4a405cb7d3ac6716d03e58fb4a5d9";
- sha256 = "18ypj9an2jmsmdn58853rbz42r10587h7cz5fdws2x4635778ibd";
- stripLen = 1;
- extraPrefix = "slirp/";
- })
- # patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7211
- (fetchpatch {
- name = "CVE-2020-7211.patch";
- url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=14ec36e107a8c9af7d0a80c3571fe39b291ff1d4";
- sha256 = "1lc8zabqs580iqrsr5k7zwgkx6qjmja7apwfbc36lkvnrxwfzmrc";
- stripLen = 1;
- extraPrefix = "slirp/";
- })
] ++ optional nixosTestRunner ./force-uid0-on-9p.patch
++ optionals stdenv.hostPlatform.isMusl [
(fetchpatch {
@@ -145,6 +109,8 @@ stdenv.mkDerivation rec {
"--sysconfdir=/etc"
"--localstatedir=/var"
"--enable-docs"
+ "--enable-tools"
+ "--enable-guest-agent"
]
# disable sysctl check on darwin.
++ optional stdenv.isDarwin "--cpu=x86_64"
@@ -162,16 +128,25 @@ stdenv.mkDerivation rec {
++ optional cephSupport "--enable-rbd"
++ optional openGLSupport "--enable-opengl"
++ optional virglSupport "--enable-virglrenderer"
+ ++ optional tpmSupport "--enable-tpm"
++ optional smbdSupport "--smbd=${samba}/bin/smbd";
doCheck = false; # tries to access /dev
-
- postFixup =
- ''
- # copy qemu-ga (guest agent) to separate output
- mkdir -p $ga/bin
- cp $out/bin/qemu-ga $ga/bin/
- '';
+ dontWrapGApps = true;
+
+ postFixup = ''
+ # the .desktop is both invalid and pointless
+ rm $out/share/applications/qemu.desktop
+
+ # 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.
postInstall = ''