Cook pasta according to package directions. Set aside.
While pasta is cooking, make pesto by combining all ingredients in a food processor except olive oil. While blending, drizzle in olive oil. Scrape down the sides as necessary.
Heat a saute pan to medium and add 2 tablespoons olive oil. When oil is lightly shimmering, add onions and mushrooms. Cook, for 4-6 minutes until veggies are lightly golden brown around the edges. Add cooked pasta and 3/4 of your pesto. Mix everything together, adding a splash of water or two as necessarily to coat pasta evenly with pesto. Taste for seasoning and add more pesto as you like.
Keep covered and refrigerated for up to 1 week.