anchor.diff:            # originally this used `sed -i "1i$layerID" layer-list`, but
             # would fail if layer-list was completely empty.
             echo "$layerID/layer.tar"
  -        ) | ${pkgs.moreutils}/bin/sponge layer-list
  +        ) | sponge layer-list
   
           # Create image json and image manifest
           imageJson=$(cat ${baseJson} | jq ". + {\"rootfs\": {\"diff_ids\": [], \"type\": \"layers\"}}")
  
positive.code:     postMount ? "",
      postUmount ? ""
    }:
      vmTools.runInLinuxVM (
        runCommand name {
          preVM = vmTools.createEmptyImage {
            size = diskSize;
  
negative.code:         (cd layer; ${extraCommandsScript})
  
          echo "Packing layer..."
          mkdir -p $out
          tar -C layer --hard-dereference --sort=name --mtime="@$SOURCE_DATE_EPOCH" -cf $out/layer.tar .
  
          # Compute the tar checksum and add it to the output json.
  