It depends on the spacing and shape of the dropouts. As I remember, Nexus 8 is 120mm OLD spacing on the frame. That stands for "Over Locknut Distance". It's the distance between the rear dropouts. Most geared hubs are going to use either 130 or 135mm OLD. So if it's not already that wide, and it's a steel frame, it may be able to be cold set that wide, if it's aluminum, I wouldn't really chance it.
The mounting for the rear derailleur itself is going to be the other big hurdle. Does the frame have a derailleur hole next to the axle for threading on a direct mount derailleur? If not, a hanger that matches the dropout style may be in order. Depending on the type of dropouts(front facing, rear facing, etc) it may be as simple as installing a derailleur that has the hanger built into it, or you may have to buy a "problem solver" part that adds a hanger to the frame.
The last hurdle you'll run into, you say you may need to replace your cranks and chain, that's wonderful news. Because you'll need to get a chain that is compatible with whatever speed shifting system you are looking to install, and a crank(or at least chainring) that is also compatible with that chain.
Then you just install all of that, in the process altering the frame to match if necessary, and install a shifter that works with the derailleur and you're good to go.
Usually, this alteration is more hassle and cost than it's worth. It's usually more worthwhile to get a new 8-speed Nexus hub or buy a bike with gears. But that's completely up to you.