01 -
Melt the butter in a saucepan over medium heat. Add the onion and cook until tender, approximately 3-5 minutes.
02 -
Add the garlic and thyme to the saucepan, cooking until fragrant, approximately 1 minute.
03 -
Sprinkle in the flour, mix well and cook until it starts to turn lightly golden brown, about 1 minute.
04 -
Gradually add the milk, stirring constantly. Cook until the sauce thickens, approximately 1-2 minutes.
05 -
Reduce the heat and add 1/2 cup of the shredded Gruyere cheese. Stir until melted. Incorporate nutmeg if using and season with salt and pepper to taste.
06 -
Spread a thin layer of sauce on the bottom of a large baking dish. Layer the potato slices with sauce in between each layer. Optionally, dip each slice into the sauce as you place it into the dish.
07 -
Pour any remaining sauce over the layered potatoes in the dish. Sprinkle the remaining shredded cheese on top.
08 -
Bake in a preheated oven at 350°F (180°C) until the potatoes are tender, approximately 45-60 minutes.