anchor.diff:  , nixosTestRunner ? false
   }:
   
  -with lib;
   let
  -  audio = optionalString alsaSupport "alsa,"
  -    + optionalString pulseSupport "pa,"
  -    + optionalString sdlSupport "sdl,";
  +  audio = lib.optionalString alsaSupport "alsa,"
  +    + lib.optionalString pulseSupport "pa,"
  +    + lib.optionalString sdlSupport "sdl,";
   
   in
   
   stdenv.mkDerivation rec {
  -  version = "6.0.0";
     pname = "qemu"
       + lib.optionalString xenSupport "-xen"
       + lib.optionalString hostCpuOnly "-host-cpu-only"
       + lib.optionalString nixosTestRunner "-for-vm-tests";
  +  version = "6.0.0";
   
     src = fetchurl {
       url= "https://download.qemu.org/qemu-${version}.tar.xz";
  
positive.code:       url = "https://gitlab.com/qemu-project/qemu/-/commit/9f22893adcb02580aee5968f32baa2cd109b3ec2.patch";
        sha256 = "1vkhm9vl671y4cra60b6704339qk1h5dyyb3dfvmvpsvfyh2pm7n";
      })
    ] ++ optional nixosTestRunner ./force-uid0-on-9p.patch
      ++ optionals stdenv.hostPlatform.isMusl [
      (fetchpatch {
        url = "https://raw.githubusercontent.com/alpinelinux/aports/2bb133986e8fa90e2e76d53369f03861a87a74ef/main/qemu/xattr_size_max.patch";
        sha256 = "1xfdjs1jlvs99hpf670yianb8c3qz2ars8syzyz8f2c2cp5y4bxb";
  
negative.code:   };
  
    nativeBuildInputs = [ python python.pkgs.sphinx pkg-config flex bison meson ninja ]
      ++ lib.optionals gtkSupport [ wrapGAppsHook ]
      ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
  
    buildInputs = [ zlib glib perl pixman
      vde2 texinfo makeWrapper lzo snappy
      gnutls nettle curl
    ]
      ++ lib.optionals ncursesSupport [ ncurses ]
      ++ lib.optionals stdenv.isDarwin [ CoreServices Cocoa Hypervisor rez setfile ]
      ++ lib.optionals seccompSupport [ libseccomp ]
      ++ lib.optionals numaSupport [ numactl ]
      ++ lib.optionals pulseSupport [ libpulseaudio ]
      ++ lib.optionals sdlSupport [ SDL2 SDL2_image ]
      ++ 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 ]
      ++ lib.optionals stdenv.isLinux [ alsa-lib libaio libcap_ng libcap attr ]
      ++ lib.optionals xenSupport [ xen ]
      ++ lib.optionals cephSupport [ ceph ]
      ++ lib.optionals glusterfsSupport [ glusterfs libuuid ]
      ++ lib.optionals openGLSupport [ mesa epoxy libdrm ]
      ++ lib.optionals virglSupport [ virglrenderer ]
      ++ lib.optionals libiscsiSupport [ libiscsi ]
      ++ lib.optionals smbdSupport [ samba ];
  
    dontUseMesonConfigure = true; # meson's configurePhase isn't compatible with qemu build
  
  