01 - Set oven to 375°F to prepare for baking.
02 - Combine flour and salt in a large bowl. Cut in butter until mixture forms coarse crumbs. Add ice water tablespoon by tablespoon, mixing until dough forms. Shape into a disc, wrap, and refrigerate for 20 minutes.
03 - Roll dough on floured surface to fit a 9-inch tart pan. Press into pan, trim edges, prick base with fork. Refrigerate for 10 minutes.
04 - Line tart shell with parchment and fill with pie weights. Bake 15 minutes, remove weights and parchment, then bake an additional 5 minutes. Allow to cool slightly.
05 - Heat olive oil and butter on medium in a skillet. Add onions, salt, pepper, thyme, and sugar. Cook, stirring occasionally, until soft and golden, about 25 to 30 minutes. Stir in garlic and cook 2 minutes more. Let cool.
06 - Whisk eggs, heavy cream, whole milk, salt, and nutmeg until combined.
07 - Evenly spread caramelized onions over crust. Sprinkle with Gruyère cheese. Pour custard mixture on top.
08 - Bake for 25 to 30 minutes until custard is set and golden. Let rest 10 minutes before slicing.