Preheat the oven to 180 C. Place walnuts on a baking tray and roast for 8 to 10 minutes. Stir once or twice for even toasting.
Heat oil in a large heavy saucepan over medium high heat. Add onion and mushrooms and cook until tender and golden brown.
Pour in stock, stir in rice, reduce heat to low, and cover. Simmer until rice is tender and liquid is absorbed, about 20 minutes. If after 20 minutes there is still liquid, remove cover, and cook until liquid has evaporated. Remove from heat, and stir in walnuts. Season with salt and pepper to taste.