anchor.diff:    sources = map (x: x.source) contents;
     targets = map (x: x.target) contents;
   
  +  closureInfo = pkgs.closureInfo { rootPaths = [ config.system.build.toplevel channelSources ]; };
  +
     prepareImage = ''
  -    export PATH=${makeBinPath prepareImageInputs}
  +    export PATH=${binPath}
   
       # Yes, mkfs.ext4 takes different units in different contexts. Fun.
       sectorsToKilobytes() {
  
positive.code:   pkgs.runCommand name
      { preVM = prepareImage;
        buildInputs = with pkgs; [ utillinux e2fsprogs dosfstools ];
        exportReferencesGraph = [ "closure" metaClosure ];
        postVM = ''
          ${if format == "raw" then ''
            mv $diskImage $out/${filename}
  
negative.code:       fi
      done
  
      export HOME=$TMPDIR
  
      # Provide a Nix database so that nixos-install can copy closures.
      export NIX_STATE_DIR=$TMPDIR/state
      nix-store --load-db < ${closureInfo}/registration
  
      echo "running nixos-install..."
      nixos-install --root $root --no-bootloader --no-root-passwd --closure ${config.system.build.toplevel} --substituters ""
  
      echo "copying staging root to image..."
      cptofs -p ${optionalString (partitionTableType != "none") "-P ${rootPartition}"} -t ${fsType} -i $diskImage $root/* /
  