           hash.update chunk
         res.on 'end', ->
           console.log """
-            #{}  "#{name}" = self."#{name}-#{version}";
+            #{}  "#{name}" = self."#{name}-#{range}";
 
-              "#{name}-#{version}" = self.buildNodePackage rec {
+              "#{name}-#{range}" = self.buildNodePackage rec {
                 name = "#{name}-#{version}";
                 src = fetchurl {
                   url = "http://registry.npmjs.org/#{name}/-/${name}.tgz";

    res.on 'end', ->
      pkginfo = JSON.parse val
      versions = (key for own key, value of pkginfo.versions)
      version = semver.maxSatisfying versions, version
      deps = pkginfo.versions[version].dependencies ? {}
      (generateExpr(nm, ver) unless generated[nm + "-" + ver]?) for nm, ver of deps
      http.get "http://registry.npmjs.org/#{name}/-/#{name}-#{version}.tgz", (res) ->


generated = {}

generateExpr = (name, range) ->
   generated[name + "-" + range] = true
   http.get "http://registry.npmjs.org/#{name}", (res) ->
    res.setEncoding()
    val = ""
