Pick a small area of the home in which to start. Take everything off the walls, and move furniture out or to the center of the room and cover it.
Mix 1/2 cup of ammonia with 1 gallon of water in a bucket. Wearing gloves, use a gentle scrub brush to work this solution onto the walls and ceiling of the room. Vinegar can be used as an alternative to ammonia, but it may not have the same cleaning power.
Allow the ceiling and walls to dry, and open a window in the room if possible to let the ammonia or vinegar scent dissipate.
Check the room for a nicotine smell. If the nicotine exposure was recent and not present for an extended length of time, the ammonia or vinegar should remove it. If vinegar did not work, try the same process with ammonia. Years of exposure will likely not clean off. In this case, the walls and ceilings must be sealed.
Purchase a sealing, oil-based primer at a home improvement or paint store.
Apply the primer using a brush and roller, just like paint, to the ceiling, followed by the walls. Allow plenty of ventilation in the room as these primers have very strong smells.
Air the room out well and allow the primer to dry. The smell should no longer be detectable. Oil-based primers will also prevent any stains from working up through the paint later on.
Apply a second coat of primer if necessary for smooth and complete coverage, then paint over the primed surface using a latex-based paint.