Thinly slice the bread and toast it. Butter an ovenproof dish and alternately layer the bread and grated cheese in it. Peel and chop the onions. Brown in the butter. Sprinkle with the flour, mix well and add the stock.
Season with salt, pepper and nutmeg and bring to the boil. Remove from the heat and pour over the bread and cheese. Bake in the oven at 240 °C/450 F for about 20 minutes and serve immediately