Preheat the oven to 400°F, and grease a large casserole dish with oil, butter, or cooking spray. Preheat a large skillet over medium heat. Melt butter in a large skillet. Cook onions with a pinch of salt until golden brown, about 7-10 minutes. Add garlic to the skillet, stirring frequently, and cook until fragrant, about 30 seconds.
Add in cream cheese in small blocks, and the heavy whipping cream and milk. Whisk the cream cheese and milk mixture until a sauce forms, then, add in most of the cheese, reserving some cheese for topping the potatoes later. Mix in more salt, pepper, nutmeg, cayenne, dried thyme, fresh parsley, and chives.
Now, add potatoes to the casserole dish in a thin layer, alternating between cheese sauce and potatoes. Continue alternating the layers, then, when you get to the top, add the remaining shredded cheese. Cover with aluminum foil and bake for an hour and 30 minutes, covered. Take the foil off, and bake for an additional 30 minutes to get the cheese nice and crispy on top.
Let stand for 15-20 minutes before digging in. Enjoy!
Store in an airtight container in the fridge for up to 5 days. Reheat in the microwave, or in the oven. We don't recommend freezing.