Spray a casserole dish or 9x13 pan with nonstick cooking spray and set aside. Preheat oven to 425 degrees.
Peel potatoes and rinse. Slice into 1/4-inch pieces and set aside.
For the cream sauce:
In a deep skillet, melt butter over medium heat. Fry onions until lightly browned and fragrant, about 5 minutes. Sprinkle in flour and whisk until a smooth paste is created. Slowly whisk in milk and bring to simmer. Add in salt, pepper, and nutmeg while waiting for the sauce to bubble. The sauce should thicken once it starts bubbling. Remove from heat and stir in heavy cream. Taste and adjust seasonings. Once you get the sauce to taste how you like, add in a little extra salt.
For assembly:
Spread about 1/3 cup cream sauce into the casserole dish. Add about half the potatoes, being sure to separate from each other as best as possible. Top with half the remaining cream sauce and half the cheddar cheese. Top with remaining potatoes, sauce and cheese.
Bake for 1 hour uncovered. Check after 30-40 minutes to ensure the top isn't getting too brown. If it is, cover with foil for remaining baking time. Cool 10-15 minutes before serving.