anchor.diff:          driveExtraOpts.cache = "writeback";
           driveExtraOpts.werror = "report";
         }]
  +      (mkIf cfg.useNixStoreImage [{
  +        name = "nix-store";
  +        file = ''"$TMPDIR"/store.img'';
  +        deviceExtraOpts.bootindex = if cfg.useBootLoader then "3" else "2";
  +      }])
         (mkIf cfg.useBootLoader [
           # The order of this list determines the device names, see
           # note [Disk layout with `useBootLoader`].
  
positive.code:     virtualisation.pathsInNixDB = [ config.system.build.toplevel ];
  
      virtualisation.sharedDirectories = {
        nix-store = { source = "/nix/store"; target = "/nix/store"; };
        xchg      = { source = ''"$TMPDIR"/xchg''; target = "/tmp/xchg"; };
        shared    = { source = ''"''${SHARED_DIR:-$TMPDIR/xchg}"''; target = "/tmp/shared"; };
      };
  
      virtualisation.qemu.networkingOptions =
  
negative.code:       if [ -z "$TMPDIR" ] || [ -z "$USE_TMPDIR" ]; then
            TMPDIR=$(mktemp -d nix-vm.XXXXXXXXXX --tmpdir)
        fi
  
        ${lib.optionalString cfg.useNixStoreImage
        ''
          # Create a writable copy/snapshot of the store image.
          ${qemu}/bin/qemu-img create -f qcow2 -F qcow2 -b ${storeImage}/nixos.qcow2 "$TMPDIR"/store.img
        ''}
  
        # Create a directory for exchanging data with the VM.
        mkdir -p "$TMPDIR/xchg"
  