At the risk of sounding banal, I believe it's worth checking to see if you have a severe depression. Because that's how depression feels. There are people out there who derive great pleasure from writing uninspired code. Not only doesn't work need to be the main source of meaning in your live (in addition to providing income), its perceived value is heavily dependent on your psychological and physiologial condition. In fact, I'm afraid that, thae way you are now, you might not be able to enjoy yourself even if your situation changed for the better.
This is a bleak message, yet it's true: most people do not like their jobs very much. They can just deal with it because they're not totally depressed. And the reason is, surprisingly often, simple brain chemistry. At least try some more roads before talking of suicide.