Boil a big pot of water for the pasta. Heat olive oil in a large frying pan.
Add diced onion to the pan and fry on a low heat until soft, then add in diced carrot and celery. Fry until soft, stirring frequently. Add garlic and saute until it softens and becomes fragrant.
Place sun-dried tomatoes in a small bowl. Ladle out a small amount of boiling water and pour it over the tomatoes. Let them soak for 5 to 10 minutes to soften. Cook pasta in the remaining water until nearly al dente, drain and set aside.
Chop softened sun-dried tomatoes roughly and place in a mortar and pestle. Pound them into a paste. Add walnuts and chopped basil and work them into the sun-dried tomatoes. Add a bit of olive oil or water and continue to mix.
Move mirepoix (onion, carrot, celery and garlic mixture) to the side of the pan and place cherry tomatoes on the pan, cut side down. Let them cook for about 1 minute, then add pesto, cooked lentils, tomato sauce and balsamic vinegar. Season with sea salt, black pepper, nutmeg, chili and sugar if needed.
Add cooked pasta to the pan. Toss it in the sauce, let it warm up for a minute and serve.