anchor.diff:        in
         # Combine the results into a single set.
         foldl (a: b: a // b) {} cycles';
  -
  -  # Next we need a function which given a list of packages, retrieves
  -  # all of those packages' dependencies. This is a simple fold.
  -  allDependencies = packageList:
  -    foldl (a: b: a // b) {} (map (p: p.runtimeDependencies) packageList);
  -
  -  # Here's a bit of bash that will extract a package into node_modules.
  -  extractPkg = p: "tar xf ${p.src} && mv package node_modules/${p.fullName}";
   
     # We'll put all of these together below, for packages that have
     # circular dependencies.
  
positive.code:           fi
          fi
        '';
        depClosure = cycles {} self;
      in concatStringsSep "\n" (
        ["runHook preConfigure"] ++
        (flip map (attrValues requiredDependencies) (dep:
  
negative.code:           ${concatMapStrings link (attrValues dep.peerDependencies)}
          '')) ++
        ["runHook postConfigure"] ++
        (optional (circulars != []) (let
         in concatStringsSep "\n" [
          # Extract all of the circular dependencies' tarballs.
          (concatMapLines circulars (dep: ''
            echo Satisfying ${dep.fullName}, circular dependency \
              of ${self.fullName}
            mkdir -p node_modules
            if [[ ! -d node_modules/${dep.fullName} ]]; then
              tar xf ${dep.src}
              if [[ ! -d package ]]; then
                echo "Expected ${dep.src} to be a tarball containing a" \
                     "'package' directory. Don't know how to handle this :("
                exit 1
              fi
              mv package node_modules/${dep.fullName}
            fi
          ''))
          # Symlink all of the transitive dependencies of the circular packages.
          (concatMapLines (attrValues transCircularDeps) link)
          # Create a temporary symlink to the current package directory,
          # so that node knows that the dependency is satisfied when
          # checking the recursive dependencies (grumble grumble).
          "ln -s $PWD node_modules/${self.fullName}"
        ]
      )));
  
      buildPhase = concatStringsSep "\n" [
        "runHook preBuild"
        ''
        (
          # NPM reads the `HOME` environment variable and fails if it doesn't
          # exist, so set it here.
  