Buying a House & Writing it off as an office

Can you buy a house and register it as your office / business headquarters and write it off in addition to all the expenses incurred with repairs, etc?
If so, does that mean you can't write off any other business expenses (such as materials, transportation, etc)