     stream.write """
     \n  "#{escapeNixString name}"."#{escapeNixString spec}" = {
         version = "#{escapeNixString pkg.version}";
-        topLevel = #{if fullNames[name]?[spec]? then 'true' else 'false'};
         dependencies = [
     """
     patchLatest = 'false'


    addPackage = (name, spec) ->
      spec = '*' if spec is 'latest' or spec is '' #ugh
      fullNames[name] ?= {}
      fullNames[name][spec] = true
      fetcher.fetch name, spec, registry
    if packages instanceof Array
      for pkg in packages

    if pkg.dist.tarball?
      stream.write "\n    tarball = \"#{pkg.dist.tarball}\";"
    stream.write "\n  };"
    if fullNames[name] is spec
      stream.write """
      \n  "#topLevel"."#{escapeNixString name}" = "#{escapeNixString spec}";
      """
  finalizePkgs = ->
    stream.end "\n}\n"

