Preheat the oven to 375°F.
Sprinkle the eggplant slices with salt and let them sit for about 30 minutes to draw out moisture. Rinse and pat dry with paper towels.
In a large skillet, heat olive oil over medium heat. Fry the eggplant slices in batches until golden brown, about 3-4 minutes per side. Drain on paper towels.
In the same skillet, add a little more olive oil if needed, then sauté the chopped onion until translucent, about 5 minutes. Add the minced garlic and cook for another minute.
Add the ground beef or lamb to the skillet, breaking it apart with a spoon. Cook until browned, about 5-7 minutes. Drain excess fat if necessary.
Stir in the crushed tomatoes, tomato paste, oregano, cinnamon, black pepper, red pepper flakes (if using), and parsley. Simmer for about 10 minutes until the sauce thickens slightly.
In a bowl, combine the ricotta cheese, half of the mozzarella cheese, half of the Parmesan cheese, eggs, milk, flour, and nutmeg. Mix until smooth.
In a greased 9x13-inch baking dish, layer half of the fried eggplant slices on the bottom. Spread the meat sauce evenly over the eggplant, then layer the remaining eggplant on top. Pour the ricotta mixture over the final layer of eggplant.
Sprinkle the remaining mozzarella and Parmesan cheese on top.
Bake in the preheated oven for 30-35 minutes, or until the top is golden and bubbly. Let it cool for 10 minutes before serving.