  Defect centers in diamond are exceptional solid-state quantum systems that
can have exceedingly long electron and nuclear spin coherence times. So far,
single-qubit gates for the nitrogen nuclear spin, a two-qubit gate with a
nitrogen-vacancy (NV) center electron spin, and entanglement between nearby
nitrogen nuclear spins have been demonstrated. Here, we develop a scheme to
implement a universal two-qubit gate between two distant nitrogen nuclear
spins. Virtual excitation of an NV center that is embedded in an optical cavity
can scatter a laser photon into the cavity mode; we show that this process
depends on the nuclear spin state of the nitrogen atom. If two NV centers are
simultaneously coupled to a common cavity mode and individually excited,
virtual cavity photon exchange can mediate an effective interaction between the
nuclear spin qubits, conditioned on the spin state of both nuclei, which
implements a universal controlled-$\textit{Z}$ gate. We predict operation times
below 100 nanoseconds, which is several orders of magnitude faster than the
decoherence time of nuclear spin qubits in diamond.
