Brush the red kuri squash (choose an organic one) and cut it into small pieces, without peeling it.
Half the garlic cloves and finely chop the onion.
In a gratin dish (pour some oil or cover with baking paper), arrange the cut pumpkin with the garlic cloves, chopped onion and walnuts.
Pour a drizzle of olive oil, thyme, salt and pepper.
Mix everything together with a spoon.
If you wish to add mushrooms: add them at this moment mixing well with the other ingredients.
Arrange the slices of bacon on top (or pour half of the mixture of ingredients, arrange the slices of bacon and cover with the rest of the filling).
Cut the cheese into slices and arrange them to cover the gratin.
Bake at 180°C for about 30 minutes. Check the cooking of the pumpkin with the tip of a knife.
Serve with pasta or a green salad.