anchor.diff:          };
           inherit fromImage fromImageName fromImageTag;
   
  -        buildInputs = [ utillinux e2fsprogs jshon rsync jq ];
  +        buildInputs = [ utillinux e2fsprogs jshon rsync ];
         } ''
         rm -rf $out
   
  
positive.code:         tar -rpf temp/layer.tar --mtime="@$SOURCE_DATE_EPOCH" \
            --owner=0 --group=0 --no-recursion --files-from newFiles
  
          gzip temp/layer.tar
          layerID="sha256:$(sha256sum temp/layer.tar.gz | cut -d ' ' -f 1)"
          mv temp/layer.tar.gz image/$layerID
  
          echo "Generating image configuration and manifest..."
          imageJson=$(cat ${baseJson} | jq ". + {\"rootfs\": {\"diff_ids\": [], \"type\": \"layers\"}}")
          manifestJson=$(jq -n "[{\"RepoTags\":[\"$imageName:$imageTag\"]}]")
  
          # The layer list is ordered starting from the base image
          layers=$(echo $layers $layerID)
          for i in $(echo $layers); do
            imageJson=$(echo "$imageJson" | jq ".history |= [{\"created\": \"${created}\"}] + .")
            diffId=$(gzip -dc image/$i | sha256sum | cut -d" " -f1)
            imageJson=$(echo "$imageJson" | jq ".rootfs.diff_ids |= [\"sha256:$diffId\"] + .")
            manifestJson=$(echo "$manifestJson" | jq ".[0].Layers |= [\"$i\"] + .")
          done
  
          imageJsonChecksum=$(echo "$imageJson" | sha256sum | cut -d ' ' -f1)
          echo "$imageJson" > "image/sha256:$imageJsonChecksum"
          manifestJson=$(echo "$manifestJson" | jq ".[0].Config = \"sha256:$imageJsonChecksum\"")
          echo "$manifestJson" > image/manifest.json
  
          # Make the image read-only.
          chmod -R a-w image
  
negative.code:       mount /dev/${vmTools.hd} disk
        cd disk
  
        if [[ -n "$fromImage" ]]; then
          echo "Unpacking base image..."
          mkdir image
          tar -C image -xpf "$fromImage"
  
          # If the image name isn't set, read it from the image repository json.
          if [[ -z "$fromImageName" ]]; then
            fromImageName=$(jshon -k < image/repositories | head -n 1)
            echo "From-image name wasn't set. Read $fromImageName."
          fi
  
          # If the tag isn't set, use the name as an index into the json
          # and read the first key found.
          if [[ -z "$fromImageTag" ]]; then
            fromImageTag=$(jshon -e $fromImageName -k < image/repositories \
                           | head -n1)
            echo "From-image tag wasn't set. Read $fromImageTag."
          fi
  
          # Use the name and tag to get the parent ID field.
          parentID=$(jshon -e $fromImageName -e $fromImageTag -u \
                     < image/repositories)
        fi
  
        # Unpack all of the parent layers into the image.
        lowerdir=""
        while [[ -n "$parentID" ]]; do
          echo "Unpacking layer $parentID"
          mkdir -p image/$parentID/layer
          tar -C image/$parentID/layer -xpf image/$parentID/layer.tar
          rm image/$parentID/layer.tar
  
          find image/$parentID/layer -name ".wh.*" -exec bash -c 'name="$(basename {}|sed "s/^.wh.//")"; mknod "$(dirname {})/$name" c 0 0; rm {}' \;
  
          # Get the next lower directory and continue the loop.
          lowerdir=$lowerdir''${lowerdir:+:}image/$parentID/layer
          parentID=$(cat image/$parentID/json \
                    | (jshon -e parent -u 2>/dev/null || true))
        done
  
        mkdir work
  