anchor.diff:          ''
             # VM needs writable EFI vars
             if ! test -e "$NIX_EFI_VARS"; then
  -            cp ${bootDisk}/efi-vars.fd "$NIX_EFI_VARS" || exit 1
  -            chmod 0644 "$NIX_EFI_VARS" || exit 1
  +            cp ${bootDisk}/efi-vars.fd "$NIX_EFI_VARS"
  +            chmod 0644 "$NIX_EFI_VARS"
             fi
           ''}
         ''}
   
  -      cd "$TMPDIR" || exit 1
  +      cd "$TMPDIR"
   
         ${lib.optionalString (cfg.emptyDiskImages != []) "idx=0"}
         ${flip concatMapStrings cfg.emptyDiskImages (size: ''
  
positive.code:     ''
        #! ${pkgs.runtimeShell}
  
        NIX_DISK_IMAGE=$(readlink -f "''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}}")
  
        if ! test -e "$NIX_DISK_IMAGE"; then
            ${qemu}/bin/qemu-img create -f qcow2 "$NIX_DISK_IMAGE" \
              ${toString config.virtualisation.diskSize}M || exit 1
        fi
  
        # Create a directory for storing temporary data of the running VM.
        if [ -z "$TMPDIR" -o -z "$USE_TMPDIR" ]; then
            TMPDIR=$(mktemp -d nix-vm.XXXXXXXXXX --tmpdir)
        fi
  
  
negative.code:       ''
          # Create a writable copy/snapshot of the boot disk.
          # A writable boot disk can be booted from automatically.
          ${qemu}/bin/qemu-img create -f qcow2 -F qcow2 -b ${bootDisk}/disk.img "$TMPDIR/disk.img"
  
          NIX_EFI_VARS=$(readlink -f "''${NIX_EFI_VARS:-${cfg.efiVars}}")
  
  