anchor.diff:            '';
           };
   
  +      drives =
  +        mkOption {
  +          type = types.listOf (types.submodule driveOpts);
  +          description = "Drives passed to qemu.";
  +        };
  +
         diskInterface =
           mkOption {
             default = "virtio";
  
positive.code: 
    cfg = config.virtualisation;
  
    qemuGraphics = lib.optionalString (!cfg.graphics) "-nographic";
  
    consoles = lib.concatMapStringsSep " " (c: "console=${c}") cfg.qemu.consoles;
  
    # XXX: This is very ugly and in the future we really should use attribute
    # sets to build ALL of the QEMU flags instead of this mixed mess of Nix
    # expressions and shell script stuff.
    mkDiskIfaceDriveFlag = idx: driveArgs: let
      inherit (cfg.qemu) diskInterface;
      # The drive identifier created by incrementing the index by one using the
      # shell.
      drvId = "drive$((${idx} + 1))";
      # NOTE: DO NOT shell escape, because this may contain shell variables.
      commonArgs = "index=${idx},id=${drvId},${driveArgs}";
      isSCSI = diskInterface == "scsi";
      devArgs = "${diskInterface}-hd,drive=${drvId}";
      args = "-drive ${commonArgs},if=none -device lsi53c895a -device ${devArgs}";
    in if isSCSI then args else "-drive ${commonArgs},if=${diskInterface}";
  
    # Shell script to start the VM.
    startVM =
  
negative.code: 
      # FIXME: Consolidate this one day.
      virtualisation.qemu.options = mkMerge [
        (mkIf (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) [
          "-vga std" "-usb" "-device usb-tablet,bus=usb-bus.0"
        ])
        (mkIf (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [
          "-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet"
        ])
        (mkIf (!cfg.useBootLoader) [
          "-kernel ${config.system.build.toplevel}/kernel"
          "-initrd ${config.system.build.toplevel}/initrd"
          ''-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS"''
        ])
        (mkIf cfg.useEFIBoot [
          "-pflash $TMPDIR/bios.bin"
        ])
        (mkIf (!cfg.graphics) [
          "-nographic"
        ])
      ];
  
      virtualisation.qemu.drives = mkMerge [
        (mkIf cfg.useBootLoader [
          {
            file = "$NIX_DISK_IMAGE";
            driveExtraOpts.cache = "writeback";
            driveExtraOpts.werror = "report";
          }
          {
            file = "$TMPDIR/disk.img";
            driveExtraOpts.media = "disk";
            deviceExtraOpts.bootindex = "1";
          }
        ])
        (mkIf (!cfg.useBootLoader) [
          {
            file = "$NIX_DISK_IMAGE";
            driveExtraOpts.cache = "writeback";
            driveExtraOpts.werror = "report";
          }
        ])
        (imap0 (idx: _: {
          file = "$(pwd)/empty${toString idx}.qcow2";
          driveExtraOpts.werror = "report";
        }) cfg.emptyDiskImages)
      ];
  
      # Mount the host filesystem via 9P, and bind-mount the Nix store
  