In a large bowl, combine the flour, salt, and butter. Rub together with your fingers until the mixture looks like breadcrumbs. Add the egg and cold water, knead into a smooth dough, wrap in plastic, and chill for 30 minutes.
Preheat the oven to 350°F. Roll out the dough and press into a tart pan about 9 inches wide. Prick the base with a fork. Line with parchment paper and pie weights, then blind bake for 10 minutes.
Melt butter in a skillet over medium heat. Add sliced onions and cook for 20 minutes, stirring often, until caramelized.
In a bowl, whisk the eggs and cream. Stir in grated cheese, salt, pepper, and nutmeg.
Spread the caramelized onions over the crust, then pour the egg and cream mixture on top. Bake for 25 to 30 minutes until golden and set.
Cool slightly before slicing. Serve warm or chilled.