anchor.diff:            ${optionalString (grubVersion == 1) ''
               boot.loader.grub.splashImage = null;
             ''}
  -          boot.loader.grub.device = "${grubDevice}";
  +
             boot.loader.grub.extraConfig = "serial; terminal_output.serial";
  -          boot.loader.grub.fsIdentifier = "${grubIdentifier}";
  +          ${if grubUseEfi then ''
  +            boot.loader.grub.device = "nodev";
  +            boot.loader.grub.efiSupport = true;
  +            boot.loader.grub.efiInstallAsRemovable = true; # XXX: needed for OVMF?
  +          '' else ''
  +            boot.loader.grub.device = "${grubDevice}";
  +            boot.loader.grub.fsIdentifier = "${grubIdentifier}";
  +          ''}
   
             boot.loader.grub.configurationLimit = 100 + ${toString forceGrubReinstallCount};
           ''}
  
positive.code:     { createPartitions, preBootCommands ? "", extraConfig ? ""
      , extraInstallerConfig ? {}
      , bootLoader ? "grub" # either "grub" or "systemd-boot"
      , grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid"
      , enableOCR ? false, meta ? {}
      }:
      makeTest {
  
negative.code: let
  
    # The configuration to install.
    makeConfig = { bootLoader, grubVersion, grubDevice, grubIdentifier, grubUseEfi
                 , extraConfig, forceGrubReinstallCount ? 0
                 }:
      pkgs.writeText "configuration.nix" ''
  