Toast the walnuts in a large dry pan over a medium heat. Keep a careful eye on them and shake the pan often as they can burn quickly. As soon as they start browning on the edges, remove them from the heat. Move the walnuts from the pan onto a heat-safe dish, or directly into your food processor if your food processor can handle hot food.
Return the pan to the heat and add the olive oil. Add the onions and garlic and sauté until the onions soften and turn translucent – about 4 minutes.
Add in all the remaining ingredients; the mushrooms, parsley, rosemary, salt, and pepper, and sauté until the mushrooms have cooked and reduced in size, another 5–8 minutes.
Add the cooked mushroom mixture to the toasted walnuts and pulse in the food processor, stopping to scrape the sides as needed until you reach a pâté texture. I like to leave mine with a bit of texture and colour variation.
Press into a container for serving using a spatula to smooth it, and let chill completely in the fridge before serving. Store in an air-tight container for 2–3 days.