Part of it is probably fueled by your excessive negativity, including your mistaken belief that you've "lost all ability to sleep". I'm sure if you check that for accuracy you'll see it's an overblown exaggeration, which is likely fueling your insomnia to at least some degree. You can address the negative thoughts by using a CBT sleep training program. You might also consider seeing an MD who specializes in sleep to ensure you have no other identifiable issues disrupting your sleep.