Dude, don't kill yourself. I bet that if you give it a couple of years you'll be in a dad with a wonderful family.
As a first step I'd recommend you to get a dog though, the condition less love you get from those fellas are what took me up from my depression. Also, it gives you something to do. Activation is important.
Don't make happiness in life conditional on other people's behavior. You cannot control other people. Even if you do everything right, your wife might leave you and your kids might turn out to be serial killers. They have their own agency and can make their own choices. You can't control other people.
Unfortunately humans are incredibly hard-wired to seek happiness in other people. Even the well-balanced professionals who don't care about money indicate that the #1 thing they desire is the admiration of their colleagues. Most hackers like us definitely fit in that mold.
I don't have any solutions to that. Maybe if I identify the problem someone else can come up with an answer. Dunno.
EDIT: We should make sure admiration is not a zero-sum game. Don't tell people on HN that there are only a certain number of ways to succeed. I've probably violated this rule many times, like complaining about people making yet another framework, which forks my attention.
Dogs require taking care of. For someone who is clinically depressed and has huge problems with properly taking care of themselves, taking care of someone else might be extremely exhausting. It can also lead to blaming oneself for not treating the dog properly, regardless of how it's treated. Trust me, I've seen this in people with clinical depression.
Pets can go both ways. I've been in depressed states where my pets were the only thing keeping me going. I didn't want to live any more, but who would take care of my pets? I had to force myself to function so that the pets didn't starve or live in their own feces. That constant, gentle kick in the ass was what I needed a lot of the time.
Like you say, it can unfortunately cut the other way as well. Dogs are an especially high-risk proposition because they are a big time and money commitment, and if a person is feeling overwhelmed already... that could be trouble.
Possible compromise: volunteer at an animal shelter?
Yes! Dogs are also absolutely fantastic for motivating you to get out of bed and go for walks on a daily basis.
When you're in a low, low, low place you might not care about yourself enough to get out of bed. Or the world might be too painful. Or both things, plus one hundred other things.
But you will not stay in bed when you have that dog depending on you. You will not let the dog go hungry nor unwalked.
That said, a dog is not a magic pill! A dog is a huge commitment, nearly on the level of having a child, and if feeling overwhelmed is one of the causes of your depression, a dog could exacerbate that.
As a first step I'd recommend you to get a dog though, the condition less love you get from those fellas are what took me up from my depression. Also, it gives you something to do. Activation is important.