The US and Saudi Arabia have agreed to a civilian nuclear deal allowing Riyadh to build nuclear reactors.