There are dueling fatwas (religious law rulings) in Iran about nuclear weapons. In the presidency before that of Ahmadinejad back in 2003, Vilayat-el-faqih ("Supreme Jurisprudent") Ayatollah Ali Khamene'i issued one that declared the "development, production, and use of nuclear weapons" to be against Shari'a (Islamic law), ("Nuclear weapons unholy, Iran says Islam forbids use, clerics proclaim", Robert Collier, SFGate, 31 October 2003). He has never repudiated this fatwa.
However, there is a subsequent fatwa issued in 2006 by the mentor of President Ahmadinejad, the Ayatollah Mohammed Taghi Mesbah-Yazdi, who has also been the main pusher among the Iranian clerics of Holocaust denial, as reported by a "disciple" of his, Mohsen Gharavian. In that he supported production and use of nuclear weapons for self defense, ("Iranian fatwa approves use of nuclear weapons", Colin Freeman and Philip Sherwell, Telegraph.co.uk, 19 Feb 2006). Given that Khamene'i is now supporting Ahmadinejad, where does he stand on this?
BTW, while many Iranians are not keen on nuclear weapons, most reports have it that there is overwhelming support among the population for its ongoing civilian nuclear weapons program, which is not in violation of the Non-Proliferation Treaty, to which Iran is a signee, including presumably many of those now demonstrating in the streets of the larger Iranian cities.