Preheat oven to 375°F. Butter an 8-cup ovenproof pie or casserole dish.
Melt butter in a large saucepan over medium heat. Add onions and garlic, cooking for 6 to 8 minutes until softened and translucent but not browned. Remove from heat.
In a bowl, whisk together heavy cream, milk, Dijon mustard, nutmeg, salt, and black pepper.
Arrange half the potato slices in the prepared dish with slight overlap. Top with half the onion mixture and sprinkle with half the Gruyère and cheddar cheeses.
Repeat with remaining potato slices, onion mixture, and cheeses to create a second complete layer.
Pour the cream mixture evenly over all layers. Use a spatula to press down gently and compact the layers.
Cover the dish with aluminum foil and bake for 40 minutes.
Remove the foil and bake for an additional 20 minutes until the top is golden and the filling is bubbling at the edges.
Allow the pie to rest for 10 minutes before serving. Garnish with fresh chives if desired.
Notes
Use fresh ingredients for the best flavor.
Let the pie cool slightly before slicing for cleaner pieces.
Store leftovers in an airtight container in the refrigerator.