Saute the onions in a heavy skillet with the butter over very low heat, stirring occasionally until they are extremely tender and a golden yellow. This will take about an hour. Sprinkle with the flour, mix well, and continue to cook slowly for another 3 minutes or so. Remove from heat and allow to cool.
Whisk together the eggs and cream in a bowl. Blend in the salt, pepper and nutmeg. Arrange the onions in the bottom of the pastry shell, then sprinkle on the bacon pieces. Pour the egg custard over the onions and sprinkle on the cheese. Bake in the upper third of a 375°F oven for 25-30 minutes, or until the quiche has puffed and browned.