Prepare the Pastry: In a large bowl, mix the flour and salt. Add the butter, using a pastry cutter or your fingers to blend it into the flour until the mixture resembles coarse crumbs. Gradually add ice water, stirring until the dough comes together. Form into a disk, wrap in plastic, and refrigerate for at least 1 hour.
Pre-bake the Crust: Preheat your oven to 375°F (190°C). Roll out the dough to fit a 9-inch (23 cm) pie or tart pan. Press the dough into the pan and trim any excess. Prick the bottom with a fork, line with parchment paper, and fill with pie weights or dried beans. Bake for 20 minutes, remove the weights and parchment, and bake for another 5-10 minutes until lightly golden. Remove from the oven and let cool.
Prepare the Filling: In a skillet, cook the bacon until crisp. Remove and drain on paper towels. If using onions, sauté them in the bacon fat until soft and translucent. In a bowl, whisk together the eggs, cream, salt, pepper, and a pinch of nutmeg. Stir in the grated cheese, cooked bacon, and onions (if using).
Assemble and Bake: Pour the filling into the pre-baked crust. Bake at 375°F (190°C) for 30-35 minutes, or until the custard is set and the top is golden brown.
Serve: Let the quiche cool slightly before cutting into wedges. Serve warm or at room temperature.