The guy who owned my x5 before me was a smoker. My approach to sorting it was simple, a bit like this:

Me: "Chris, can you sort my new x5, the previous owner was a smoker"

Chris: "No problem John. Can you get it to the shed?"

On a more serious note the fabrics and seats were wet vacced a few times, all interior surfaces have been cleaned repeatedly, especially trapped areas like under the dash and the windows.

Before all that was done I put a couple of bowels of baking soda in the car for 24 hours but it made no noticeable impact.

However since I have liberally sprayed Autoglym Odour Eliminator in the car incl on the headlining which has helped. I have a febreze air freshener in the car for when there's a little lingering smell but 5 months in the smell is pretty much gone.