寝ちゃわなきゃ is a very contracted form.

Starting from the fully expanded version, this developed roughly as:

* 寝【ね】てしまわなければ
* 寝【ね】ちまわなければ
* 寝【ね】ちゃわなけりゃ
* 寝【ね】ちゃわなきゃ

I presume you understand the ~なければ + いい construction, so I won't explain that here.