A reservoir at risk of swamping a Derbyshire market town is to be drained in an operation emergency workers warned could take seven days.