Preheat the oven to 360°F.
Thinly julienne the onion. Heat some olive oil in a pan over medium heat and add the onions. Fry for 5 minutes and once the onion starts becoming translucent, add a tablespoon of sugar. Cook for 25 more minutes until caramelized. Season with salt and pepper.
Cut the potatoes into very thin slices with a mandoline slicer or a sharp knife and set aside.
Butter a rectangular baking dish and put a layer of potatoes, then a layer of caramelized onion, physalis, and repeat the same process until finishing with a layer of potatoes.
Mix the cream, grated cheese, salt, pepper, and nutmeg in a bowl. Pour this mixture over the potato dish little by little, and all the potatoes will become moist.
Bake for 45 minutes or until the potatoes are tender. Serve hot.