Heat the olive oil in a large Dutch oven or pot over medium heat. Add the onions and cook until softened and caramelized, about 20-30 minutes.
Add the garlic and thyme and cook for 1 minute more, until fragrant.
Stir in the white wine and bring to a simmer. Cook until the wine has reduced by half, about 2 minutes.
Sprinkle in the flour and whisk to coat the onions evenly.
Gradually whisk in the beef broth, bringing to a simmer.
Add the pasta and cook according to package directions, until al dente.
Stir in the heavy cream and Gruyère cheese until the cheese is melted and the sauce is smooth.
Season with salt and pepper to taste.
Serve immediately, garnished with additional Gruyère cheese, if desired.
Video
Notes
Here are some additional tips for making French onion pastaFor extra caramelized onions, cook them over low heat for up to an hour.If you don't have white wine, you can substitute chicken broth or water.If you want a richer flavor, use full-fat cream instead of heavy cream.You can also add other vegetables to the dish, such as mushrooms or spinach.French onion pasta is even better the next day, so feel free to make a big batch and enjoy it for leftovers.