Bankruptcy will not prevent you from buying a home. In fact, it may make it easier to qualify for a loan since you won’t have so much debt.
As far as Chapter 7 bankruptcies are concerned, the last time I checked,
HUD Guideline 4155.1 : 4.C.2.g provided:
A Chapter 7 bankruptcy (liquidation) does not disqualify a borrower from obtaining an FHA-insured mortgage if at least two years have elapsed since the date of the discharge of the bankruptcy.
During this time, the borrower must have
re-established good credit, or
chosen not to incur new credit obligations.
An elapsed period of less than two years, but not less than 12 months, may be acceptable for an FHA-insured mortgage, if the borrower can show that the bankruptcy was caused by extenuating circumstances beyond his/her control, and has since exhibited a documented ability to manage his/her financial affairs in a responsible manner.