In a food processor or spice grinder, grind the pistachios to a fine powder and set aside.
Bash up the ginger and garlic in a mortar and pestle to a coarse paste and set aside.
Put the oil in a wide-bottomed, lidded frying pan on a medium heat and, when it's hot, add the onions. Fry until caramelized, which should take around 20 minutes.
Add the garlic and ginger paste and stir-fry for 3 to 4 minutes before adding the tomatoes.
Put the lid on the pan and let the tomatoes cook for around 5 minutes, until they start to break down, then add the black pepper, garam masala, chili powder, coriander, cardamom, cinnamon, and salt.
Stir, then add the chicken pieces to the pan.
Turn the chicken so that it seals on all sides, then add the ground pistachios.
Stir-fry for a minute, then pour in the chicken stock.
Lightly whisk the yogurt with a fork, then stir it into the pan.
Put the lid on the pan and leave to cook for around 15 minutes.
Taste the dish and adjust as you wish. Add a little water to get a good saucy consistency if need be.
To serve, spoon over a dollop of yogurt, scatter with chopped pistachios, and squeeze over the lemon juice.
Eat with a bowl of basmati rice.
