I have thoughts like this too but mine were psychologically conditioned that way from where everything has always blown up in my face me whole life. I don't know, try conditioning yourself to think differently, it will be very hard but it can perhaps be done. I have really bad anger problems but I started getting less angry when I changed my way of thinking to "I'm not going to get mad about this" or "**** happens" for example. Perhaps add on to the end of the thoughts as a start like where you were thinking "Nothing's going to work" with "right now, but it's OK, I can try again if it doesn't." on the end.
Are you being treated by a psychiatrist and/or psychologist/therapist? If you truly have depression, meds may help. However, meds don't get rid of negative thinking. If you can, I'd recommend therapy. If not, check out Amazon.com for books on Cognitive Behavioral Therapy (CBT). Dialectical behavioral therapy (DBT) is meant for borderline personality disorder, but it can also teach you how to dispense with negative thinking. CBT is probably the best place to start, though. Actual "talk" therapy with a therapist is ideal; you really need guidance and feedback. Books/workbooks are a good supplement. That's what I do. My thinking had gotten so negative, my friends and even family, had started avoiding me. CBT has been a great help, and I'm getting my life back. Please try to get therapy. Good luck.
It is very possible that this depression is chemical in nature and needs to be treated. You are not flawed. Think of it like a physical illness and get some treatment. This could be medications, counselling to manage your symptoms or other natural treatments. Just do something. 5 months is a long time to suffer like this. Good luck