For the pastry:
- 2 cups all-purpose flour
- 1/2 teaspoon salt
- 2/3 cup unsalted butter, cold and cubed
- 4-6 tablespoons cold water
For the filling:
- 2 tablespoons unsalted butter
- 3 large onions, thinly sliced
- Salt and pepper, to taste
- 2 cups cheddar cheese, grated
- 2 eggs
- 1 cup milk
- Make the pastry: In a large bowl, combine the flour and salt. Add the cold, cubed butter and rub it into the flour with your fingertips until the mixture resembles coarse breadcrumbs. Add the cold water, one tablespoon at a time, mixing until the dough comes together. Be careful not to overwork the dough. Wrap the dough in cling wrap and chill for at least 30 minutes.
- Preheat the oven to 375 degrees F (190 degrees C).
- Make the filling: Melt the butter in a large pan over medium heat. Add the thinly sliced onions and a pinch of salt and cook, stirring occasionally, until the onions are soft and golden brown, about 20-30 minutes. Remove from heat and let cool.
- Assemble the pie: Roll out the chilled pie dough on a lightly floured surface to fit your pie dish. Transfer the dough to the dish and press it gently into the bottom and sides. Prick the base with a fork. Trim off any excess dough, leaving enough to crimp the edges.
- Spread the caramelized onions over the base of the pie crust. Sprinkle the grated cheese evenly over the onions.
- In a bowl, whisk together the eggs and milk. Season with a pinch of salt and pepper. Pour this mixture over the cheese and onions in the pie crust.
- Bake the pie for 35-45 minutes, or until the top is golden and the filling is set. Let the pie cool for a few minutes before serving.