If the smoke has actually coated the surface with a yellow residue you need to scrub the walls down with TSP “tri sodium phosphate” to clean the walls so paint will go on properly. Also, use a good quality oil based primer on the walls to help hide the outlines of pictures and furniture. Then any good quality latex paint can be applied.
Along with removing the carpet and pad, remove any curtains or drapes or other fabric materials. Most importantly, have the entire HVAC system cleaned, especially the duct work.
If the odor is real bad it would not hurt to seal the sub floor under the carpet with a primer or sealer to seal any odors into the wood. This is a method mainly used for urine smells from pets but it could be effective for this as well.
The biggest thing you can do is scrub everything, including the cabinets, counters, trim, windows – everything. If you wipe the surface with a damp rag and yellow residue comes off on the rag then nicotine is present and releasing odors to some extent.
Most likely after you replace the carpet clean the ducts and paint you will have taken care of the smell. I have seen much worse, so am confident that with much diligence and patience, you can make this home odor free.