Boil the potato pieces in salted water, after 5 minutes add the macaroons and cook for another 10 minutes, drain.
In the meantime, sauté the bacon cubes in the butter in a frying pan, add the onions, fry until soft.
Mix the two cheeses. Bring the cream to the boil.
Pour half of the potatoes / pasta, then half of the bacon / onion mixture and half of the grated cheese into a gratin dish. Do the same with the 2nd half. Finally pour the hot cream over it and bake briefly in the oven until the cheese has melted.