Melt the butter in a large pan and fry the onions. Add the spinach leaves and cook until wilted. Season with salt, pepper, nutmeg, and sugar. Add the cream and let it simmer until the liquid reduces. Spread the mixture in a casserole dish and smooth it out.
Boil the peeled potatoes in salted water. Drain and mash the potatoes. Season with salt and nutmeg. Add the butter, cream, and milk, and mix until smooth.
Spread the mashed potatoes over the spinach filling in the casserole dish and smooth it out. Crack the eggs over the casserole, distributing them evenly. Cook for 30 minutes at 360°F.
Sprinkle salt, pepper, and fresh chives over the top of the cooked egg surface.