I raised them up from out of the watery mass, out of inactivity.
~ Nun about the creation of the gods.
Nun is the deity personifying the primordial watery abyss in Ancient Egyptian religion. Nun can be seen as the first of all the gods and the creator of reality. Nun is also considered the god that will destroy existence and return everything to the nun from whence it came.
The ancient Egyptians thought of the watery abyss of Nun as surrounding a circle in which the sphere of life is contained, being the most mysterious concept in the ancient Egyptians cosmogony.
The original mound of land comes out of the waters of Nun, and from that mound came the creator deity, Atum, also known as Ra.
Celestial Cow Myth
In the myth of the Celestial Cow it is recounted how mankind plotted against Ra and how he sent his eye as the goddess Sekhmet to punish them.
Ra was growing senile, and became more irresponsible with his role as King of the Gods. After a while the people of Egypt started to dislike him more and more while also worshiping him less and less, and since Ra's power is connected to the peoples prayers, he couldn't do anything to punish them.
Out of desperation, Ra went to his father Nun, and Nun told him to cut out his own eye. When Ra did so it transformed into a lion goddess named Sekhmet. Sekhmet goes on to slaughter many people within Egypt until Ra is forced to stop her.
End of the Universe
The end is started with Atum saying that he will one day dissolve the ordered world and return to his primeval, inert state within the waters of Nun.
All things other than the creator will cease to exist, aside from Osiris, who will survive along with Atum and Nun. Details about the event are left as a mystery, including the fate of the dead egyptians who are associated with Osiris. Yet with the creator god and the god of the afterlife together in the waters that gave rise to the orderly world, there is the potential for a new universe to arise in the same way as the old universe.
Nun has been compared to Chaos from Greco-Roman mythology
As Nun is often seen as the father/mother of Ra, and Apep is often seen as the brother of Ra, Nun could be considered the father of Apep.