I’m so glad you and your boyfriend both understand that it isn’t healthy for him to be happy only while with you. Whether he means to or not, he is making you responsible for his well-being. This is dangerous for both of you. You can certainly be sympathetic. You can certainly do your best to remind him what it’s like to have some fun. But you can’t fix the essential problem. For that, he needs to see a professional. There is something going on about school and studying that is overwhelming his abilities to cope. It may be rooted in past history with family or school or his expectations for himself. His self-esteem is too wrapped up in his academic achievement, and it is immobilizing him.
Most colleges have some kind of mental health or counseling services. He could start there. If it would be helpful, you could go with him to his first session to give the counselor your perspective. But then he needs to follow through on his own. Medication might help lessen the depression, but it won’t eliminate the cause. To really get on top of his depression, he has to be willing to take himself seriously enough to do some serious talk therapy as well.
Whether or not your relationship continues, he needs to do this for himself. Life, being alive, will present him with many challenges. Knowing how to cope and feel worthwhile even when things are hard is what helps people come through problems and disasters with their confidence — and their relationships — intact.
I wish you well.