It doesn’t really matter how you spell nerve-racking – indeed the “wrack” spelling is probably now more common – but it is satisfying to know that it comes from the rack, an instrument of torture, and not wrack, which is a kind of seaweed (or an archaic spelling of wreck, as in “wrack and ruin”).