Boil a pot of water and add the spaghetti. Cook for 10 minutes and drain.
In the meantime, peel the aubergine and slice in small cubes. Put everything on a plate and heavily salt the aubergine. And by heavily, I really mean heavily. The salt will draw the moisture out and change the texture. Let it sit for 5-10 minutes.
Chop the onion. Heat some oil in a pan over medium heat and add the onion. Saute for 5 minutes. Then add the pressed or finely chopped garlic and saute for 2 more minutes.
Use a paper towel to remove most of the salt and moisture from the aubergine. Add the cubes to pan. Stir well and bake for 5 minutes.
Roughly chop the walnuts. Add the tomato puree to the pan and stir well, bake for a few minutes so it loses some of its sourness. Then add in the lentils, walnuts, the crumbled bouillon cube and 150 ml of water. Give everything a good stir, and cook for a good 15-20 minutes. Stir occasionally and add a splash of water if it cooks dry.
Finish the sauce with some more salt, black pepper and sugar. Serve with spaghetti.