Soak the rice for 2 hours. If the rice grains are large, you can lightly grind them in a mixer before soaking.
Grate the fresh coconut finely using a grater.
Heat ghee in a pan.
Add almonds and cashews to the ghee and fry until lightly golden.
Add milk to the pan and bring it to a boil.
Add the soaked rice to the boiling milk.
Add the grated coconut to the milk and rice mixture.
Cook on medium heat, stirring occasionally, until the rice is cooked and the kheer thickens. This may take about 10 minutes.
Add sugar to taste and mix well.
Add cardamom and nutmeg powder and mix well.
Cook on low heat for another 10 minutes, stirring occasionally, until the kheer reaches the desired consistency.
Garnish with pistachio pieces.
Serve hot or chilled.