Nyx is the end result of a partial-reincarnation of Nightmare Moon.
The entity known as Nightmare Moon was created from the feelings of Loneliness and Jealousy Luna felt towards her subjects and sister a millennia ago, these feelings were violently torn away and purged from Luna when she was hit by the Elements of Harmony, manifesting as teal shreds of magic that seeped their way into the foundation of the Castle of the Royal Sisters. For reasons unknown, a group of ponies that secretly view Nightmare Moon as a goddess rose among the general populace of Equestria, with their influence they somehow managed to recover the shreds in order to resurrect Nightmare Moon: free and separate from Luna with a mind and body of her own, to this end they sought to use a Zebra Incantation Ring (The equivalent of a Transmutation Circle), along with blood taken from Nightmare Moons' killer: Twilight Sparkle. These "Children of Nightmare" managed to gather the materials needed and drew blood from a paralyzed Twilight, and it was absorbed into the Shreds already gathered and begun to solidify into a ball of mass (As though it were an embryo). The process was going okay until Celestia and her Royal Guards came into the foray; receiving message from Spike of Twilights' kidnapping and unaware of the intent. The ritual was completed halfway when the Children of Nightmare fled, the "embryo" was lost in the commotion, where it would rapidly grow in a thornbush over the course of a few hours into a young filly that would be found by Twilight (who went back into the forest because she dropped one of her texts in the commotion)
Seriously: GO READ IT!!
www.fimfiction.net/story/41596…