Preheat the oven to gas 4, 180ºC, fan 160ºC. Heat the olive oil in a pan. Add the onions and a pinch of salt, and gently cook, stirring occasionally, for 8-10 minutes until softened. Stir in the rosemary and nutmeg.
Put a layer of potatoes in the base of an ovenproof dish, then a layer of the onion mix, dot with butter and season.
Keep layering up, finishing with a layer of potatoes dotted generously with butter.
Pour in the stock and bake for 1 hour until golden and bubbling.