You need one to two days to visit the Nazca Lines. There are two main ways to fit the Nazca Lines into your itinerary.
Option 1 is a 2-day side trip from Lima.
Day 1: Lima to Paracas by car/bus and then go to the Pisco airport for a Nazca Lines flight, overnight in Paracas
Day 2: Ballestas Islands tour, option for Paracas National Reserve tour, return to Lima
Option 2 is as part of a longer overland trip across southern Peru. There are multiple ways to split the trip. It is possible to arrive on an overnight bus (from Paracas or Lima), fly over the lines, and continue to your next destination in the evening. You can also stay one to two nights in Nazca city to explore archaeological sites and museums.