Bring a large pot of salted water to a boil.
Add the whole wheat pasta and cook according to package directions until al dente.
While pasta cooks, place basil, spinach, walnuts, and garlic in a food processor.
Pulse the ingredients until coarsely chopped.
With the processor running, slowly drizzle in the olive oil until the mixture is smooth.
Add nutritional yeast or Parmesan, lemon juice, salt, and pepper, then pulse briefly to combine.
Before draining the pasta, reserve 1/2 cup of the starchy cooking water.
Drain the pasta and return it to the pot or a large mixing bowl.
Toss the pasta with the prepared pesto, adding reserved pasta water 1 tablespoon at a time to reach the desired consistency.
Serve immediately, optionally garnished with extra basil or red pepper flakes.