Roast the nuts in the oven for 5-7 minutes, then chop them finely.
Cook the onion in the butter over moderate heat until it is translucent, then season with salt and add the garlic, chopped mushrooms, and herbs. Cook until the liquid released by the mushrooms has been reduced.
In a large bowl, combine the mixture with the rice, nuts, eggs, cottage cheese, and grated cheese. Season to taste with freshly ground black pepper and additional salt, if needed.
Lightly butter a loaf pan, then line it with buttered waxed paper or parchment paper. Fill the pan and bake the loaf at 375F until the top is golden and rounded, about 1 to 1 1/4 hours. The loaf should be firm when you give the pan a gentle shake. Let rest for 10 minutes before turning out.