anchor.diff:        ${preBootCommands}
         $machine->waitForUnit("multi-user.target");
         $machine->copyFileFromHost(
  -          "${ makeConfig { inherit bootLoader grubVersion grubDevice grubIdentifier extraConfig; forceGrubReinstallCount = 2; } }",
  +          "${ makeConfig { inherit bootLoader grubVersion grubDevice grubIdentifier grubUseEfi extraConfig; forceGrubReinstallCount = 2; } }",
             "/etc/nixos/configuration.nix");
         $machine->succeed("nixos-rebuild boot >&2");
         $machine->shutdown;
  
positive.code: 
        # We need to a writable nix-store on next boot.
        $machine->copyFileFromHost(
            "${ makeConfig { inherit bootLoader grubVersion grubDevice grubIdentifier extraConfig; forceGrubReinstallCount = 1; } }",
            "/etc/nixos/configuration.nix");
  
        # Check whether nixos-rebuild works.
  
negative.code:           ${optionalString (grubVersion == 1) ''
              boot.loader.grub.splashImage = null;
            ''}
  
            boot.loader.grub.extraConfig = "serial; terminal_output.serial";
            ${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};
          ''}
  