To make the pesto: Preheat the oven to 350 F and toast the walnuts for 5-7 minutes, or until fragrant. Allow to cool. Put walnuts in the food processor and grind until fine. Add the cilantro, garlic, salt, vinegar, and olive oil. Blend. If the pesto is too thick, add water, 1 teaspoon at a time, to make it smoother and the consistency you’d like. Taste and add more salt and pepper if necessary.
To make the soup: Increase the oven temperature to 400 F. In a large roasting pan, toss the squash, onions, garlic, and apples with the oil to coat. Season well with the salt, pepper and chili powder. Roast, stirring every 10 minutes, until the vegetables are fork-tender and lightly browned, about 40 minutes.
Put all of the vegetables into a big soup pot and blend until smooth with an immersion blender. Alternatively, blend the soup in batches in your food processor or blender. Return pureed soup to a large soup pot. Add more broth if the soup seems too thick. Taste and adjust the seasoning as you see fit. Serve hot in bowls with a dollop of walnut cilantro pesto.