For the gelato base: Make the gelato base of your choice, then strain into an airtight container. Cool to room temperature, then refrigerate overnight. The gelato base must be very cold before churning: this will produce the smoothest, silkiest texture.
To make the pistachio paste: Bring a small pot of water to a boil. Add the shelled pistachio nuts and simmer for two minutes. This is going to blanch the nuts and make them easier to peel and grind later on. After two minutes, drain and rinse the nuts under cold water to cool them completely.
Dry the nuts with paper towels. If the nuts still have their skin on, you need to peel them because using the nuts with the skin on will change both the color and texture of the gelato. To peel a pistachio, simply pinch it between your fingers: the skin should come right off. This steps take a bit of work, but it's worth it. Alternatively, you can look for peeled pistachios, which are going to save you the extra step (it is still necessary to blanch peeled pistachios).
Put the blanched and peeled nuts in the bowl of a food processor, then add the sugar. Pulse until the nuts are finely ground, stopping from time to time to scrape down the bowl.
Add the whole milk and the pistachio or almond extract, if using, and process until the mixture is as smooth and creamy as the food processor will make it (some tiny pistachio bits will remain but that’s ok). If you want an even smoother texture, transfer the pistachio paste to a mixing bowl and puree it further using a stick blender.
To make the pistachio gelato: Whisk the pistachio base into the cold gelato base. Pour the mixture into the bowl of an ice cream maker. Freeze according to the manufacturer’s instructions. Stop the machine when the gelato is icy but still soft.
STORAGE: Transfer the pistachio gelato to an airtight container and freeze until firm, about two hours.Pistachio gelato is at its creamiest and best if enjoyed within 2 weeks. Past that, some ice crystals will inevitably start forming (especially if the gelato is kept in the freezer section of a regular fridge, as opposed to a chest freezer) and the texture won't be quite as smooth. The gelato will still be perfectly edible for up to 2 months, but my advice is: enjoy it as quickly as possible after churning.
SERVING: Always take pistachio gelato out to room temperature 20 minutes before serving to make it easier to scoop. This will also allow you to enjoy the treat at its ideal temperature and texture.
MAKE IT DAIRY FREE: Substitute lactose-free milk or oat milk for the regular milk.