Preheat your oven to 375°F and lightly grease a 9x9-inch baking dish.
Slice the potatoes to about 1/8 inch thick—a mandolin works perfectly for this so the slices cook evenly.
In a large saucepan over medium heat, melt the butter. Add the onion and cook until it’s translucent and soft, about 4–5 minutes.
Stir in the minced garlic and cook for another 30 seconds until fragrant.
Whisk in the flour until incorporated—it’ll form a thick paste. Slowly pour in the milk or cream, whisking constantly, until the sauce begins to thicken and smooth out.
Stir in 1 cup of cheddar cheese and the Parmesan cheese, then season with mustard powder, nutmeg (if using), salt, and pepper. Remove from heat once the cheese is melted and the sauce is silky.
Layer half of the potato slices evenly in the baking dish. Season lightly with salt and pepper.
Sprinkle half of the remaining cheddar cheese over the potatoes, then spoon over half of the sauce.
Repeat with the remaining potatoes, seasoning again, and pour the rest of the cheese sauce on top. Smooth it out so everything is covered.
Cover the dish with foil and bake for 40 minutes.
Remove the foil and continue baking for 25–30 minutes, until the top is golden brown and the potatoes are tender when pierced with a knife.
Let the scalloped potatoes rest for 10–15 minutes before serving—this allows the sauce to thicken and set up beautifully.
Sprinkle chopped chives or green onions over the top just before serving for a fresh pop of color and flavor.