A generalization of nil-clean rings