Peel the onion and cut into rings. Clean the mushrooms and cut into slices. Grate cheese.
Heat the oil in a pan, fry the bacon and onions in it, then remove. Fry the mushrooms in the frying fat.
Cook the spaetzle as instructed, then drain in a sieve. Mix with onions, bacon, mushrooms and half of the cheese. Salt and pepper and place in a greased baking dish. Sprinkle with the rest of the cheese.
Bake in the oven for 20-30 minutes until the cheese is golden brown.