How can I remove the smell of cigarettes from my computer?

Air Freshener sounds like a good idea, least on the short run.

Taking apart your computer as far as possible, dismantling all the plastic trim off the case, and wiping down everything non electronic with a solution of vinegar might help - metafilter seems to suggest being in the same vicinity as a bowl of vinegar may help too.

The same thread also seems to suggest mineral stink reducers as another option.

Of course, this is a cleanup, and dosen't actually solve the original problem

You can find some things that don't work here - rice, kitty litter, incense and just airing. Dryer sheets are suggested here, which may be worth a try.

Most of the smell will be in the PSU, cleaning the case will help, but you should replace the PSU, no good way to clean the inside of a PSU of cigarette residue.

Example of a heavy computer and cigarette user.

enter image description here

I once worked on a computer network in a trucking dispatch center. Every piece of equipment I opened up had a layer of brown tar on it. It's sticky and attracts dust which liberally coats everything. Changing out network cards was difficult as the cards had actually been glued into the slots with the mixture of tar and dirt that had accumulated.

The first step for rehabilitation is to pull out the power supply and toss it in the garbage.

The next step is to use a mixture of dishwashing liquid and Glass Plus to dampen a cloth towel to wipe down the exterior and interior of any case cover you can remove. Wipe down every flat surface that will allow it. The towel should come away clean when you've finally got all the tar off. DO NOT GET THE CLEANER ON ANY ELECTRONIC COMPONENTS!!!

Avoid cleaning the motherboard and cards, there's nothing you can do here, you don't have access to an R-11 freon bath and 91% alcohol is probably the only "safe" solvent you can use to dissolve the muck which will drive it into the card slots, causing more grief than good. Any caustic liquid or cleaner that gets into components and connectors will damage them. If you have to pull any memory cards or expansion cards, use a paper towel dampened in 91% alcohol to clean the connector pads, then treat them with a q-tip soaked in DeoxIt.

CD drives have to be scrapped, what gets inside them will cause them to fail soon anyway.

Floppy drives have to be scrapped (yes, it was back then) as the muck gets into everything, half the drives would lose the optical sensors to tell whether the little drive write tab had been moved or the other side which told whether it was 720 or 1.44. Stepper motors would start seizing.

Hard drives could have the non-electronic parts wiped down, avoiding the breather holes with anything liquid (almost dry moist towel).

All this will only help reduce the stink, not eliminate it. The only way to eliminate the smell is to back everything up, throw out the equipment and get a new system. As my boss in a former career said, "Some cars can only be fixed by jacking up the radiator cap and driving a new car underneath."

Let's say that I didn't miss the job six months later when I went on to better things.