There is fairly strong evidence that sleep deprivation can trigger or exasperate depression [1].
As someone who has had chronic cyclical insomnia since my teens (17 years) in my case it has a massive effect.
When I'm coming out of an insomnia phase the first couple of days where I get a proper nights sleep I feel like I'm on drugs, it's a feeling of well-being and euphoria that is hard to describe, I have limitless energy and I'm enthusiastic about all the things I love to do.
When I'm in the middle of the no-sleep cycle, I struggle to do even basic tasks and anything requiring complete focus is basically ruled out, the world is a grey dreary place, summoning the energy to do anything is a major challenge.
I manage my insomnia without drugs (the problem with sleeping pills in my experience is that while they do make you sleep it's not a high quality sleep and that combined with the lag from the pills means I don't feel any better with them than without) by impeccable sleep hygiene, diet and exercise and the knowledge that eventually the cycle will end.