It's an unfortunate reality that there is misunderstanding of and a stigma attached to depression and other mental illnesses in modern U.S. society. While I believe the situtation is changing for the better, I've had social interactions with family members and other people in medical professions (and other professions) in which I've heard comments like "People who say they have depression are really just lazy and could change if they want to." (That's not my personal viewpoint, btw; hopefully that's obvious.) So, I can understand a reluctance to discuss the situation.
As maple_shaft's answer indicates, in general, employers in the U.S. are not supposed to discriminate against you on medical grounds. That doesn't mean it doesn't happen. When it does happens, you may never know for sure that's what happened, and it's difficult to prove in court if you suspect it. Furthermore, it may not be worth going to court: Firstly, that probably isn't an employer you would want to work for; secondly, if you sue for illegal discrimination you may find it diffcult to get interviews with other organizations.
As Monica Cellio's answer says, you don't have to disclose anything about this unless you are asked. Below are a few options I have thought of that you could use if you are asked:
Full disclosure
Tell your inteviewer that you were suffering depression and unable to work. Also tell them that you have received treatment and are able to work now. Point to your open source contributions as a demonstration of your ability to work. It is possible that the interviewer will not like your situation and discriminate against you; however, if they offer you a job, I'd expect they'd be supportive and understanding.
Partial disclosure, medical reasons
Pretty much the same as above, except don't state your specific condition. Perhaps my knowledge is out of date, but I believe that specifics about medical issues are off-limits in (U.S.) interviews. (An exception to this would be asking about medical issues which would make the applicant unable to perform the duties of the job.) Thus, if you say that you were out of work due to medical issues, but have received treatment and are recovered now, they ought to leave that subject alone.
Partial disclosure, freelancing
As you've already said, you might just say you were freelancing. You can further explain that the reason you are pursuing full time employment is the low amount of work you found.
Wanted/needed time off for personal reasons
Another tactic would be to say you just wanted/needed some time off to attend to personal issues. With this approach, don't state that it was a medical issue that caused you to miss work. In the interviewer's mind, this leaves open other possibilities, such as taking time off to travel or take care of a sick relative; of course, it could lead to thoughts of more nefarious issues also (time in jail, for example).
Recommendations
If your main interest is getting a job to get back into the work force, I do not believe any single answer here is the "best" to use in all circumstances. During interviews you will need to make a guess as to what interviewer's viewpoints are about issues such as this.
On the other hand, if you want to work in a place that will be understanding and supportive of your situation, the full disclosure route is probably best, although I can see that citing medical reasons without specifying it was depression may be as good or better. However, since some employers may be reluctant to hire you, you may need to be more patient in getting a job and have more financial resources (or resourcefulness) to get by until that job arrives.