01 - Preheat the oven to 350°F. Butter a 9x13-inch baking dish.
02 - Melt butter in a medium saucepan over medium heat. Add chopped onion and sauté until soft, about 4 minutes.
03 - Stir in flour and cook, stirring constantly, for 1 minute to form a roux.
04 - Gradually whisk in milk and heavy cream. Bring to a gentle simmer, stirring continuously, until sauce thickens, about 5 minutes.
05 - Add salt, pepper, and nutmeg. Remove from heat, then stir in 1 cup cheddar and 1/2 cup Gruyère until smooth and melted.
06 - Arrange half the sliced potatoes evenly in the baking dish. Pour half the cheese sauce over the potatoes and spread evenly. Add remaining potatoes and top with remaining sauce.
07 - Sprinkle remaining cheddar and Gruyère evenly over the top.
08 - Cover tightly with foil and bake for 45 minutes.
09 - Remove foil and bake an additional 25 to 30 minutes until potatoes are tender and top is golden and bubbly.
10 - Let rest for 10 minutes before serving. Garnish with chives or parsley if desired.