Preheat your oven to 350°F.
Slice the potatoes into thin ⅛-inch rounds using a mandoline or the slicing blade on a box grater for consistency.
Mince the onion, grate the garlic, chop the fresh thyme, and grate both portions of gruyere cheese.
Melt the butter over medium heat in a saucepan.
Add the minced onion, grated garlic, and thyme, sautéing gently for 3-5 minutes until the onion softens and becomes translucent.
Sprinkle the flour over the aromatic mixture and cook for 1 minute, stirring constantly to create a roux.
Pour in the milk slowly while whisking vigorously to prevent lumps, then continue whisking for 1-2 minutes until the sauce thickens.
Remove from heat and stir in the ½ cup gruyere cheese, ground nutmeg, salt, and pepper until the cheese melts completely.
Pour a thin layer of the cream sauce onto the bottom of a buttered baking dish.
Arrange half the sliced potatoes in an overlapping pattern over the sauce, then pour roughly half of the remaining sauce over them.
Add the remaining potatoes in another overlapping layer, then pour the rest of the sauce over the top.
Sprinkle the remaining 1 cup of grated gruyere cheese evenly over the top of the potato layers.
Bake at 350°F for 45-60 minutes, until the potatoes are tender and the top is light golden brown.
If desired, turn on the broiler for the final 2-3 minutes for a deeper crust.
Remove from the oven and let the gratin rest for 10 minutes before serving.
