I have heard somewhere that it's Shaivam that makes Sanatana Dharma eternal. Are there some reference from shastras?
It is the eternal changeless Brahman that is the source of Sanatana Dharma and it's end. This is the reason for the name Sanatana Dharma.
The Eternal Religion (Sanatana Dharma) has come out of Thee, and Thou art its protector too. Thou, the eternal, esoteric, and changeless Being, art its end.
Srimad Bhagavata Purana, III.16.18
In sanatan dharma, God is Brahman ( consciousness). Consciousness is neither created nor destroyed, it is the base of universe.
It is not possible to create or destroy consciousness, it exists everytime even before the universe is formed or after the universe is destroyed, so we call it as eternal.
Why it is not generated or destroyed?
I should be conscious to identify that you are conscious. Similarly, someone else should be conscious to identify that I am conscious. Likewise there is no begining to this, so no begining to the God also, so God in hinduism is eternal. I may not be correct in explaining, but something in these lines only proves that God is eternal.
Its God who is eternal.
Shiva Upanishad 1.5.:
महादेव उवाच पुरा रुद्रेण गदिताः शिवधर्माः सनातनाः । देव्याः सर्वगणानां च संक्षेपाद्ग्रन्थकोटिभिः ॥ १-५॥
Mahādeva Said.: In the days of yore, Lord Rudra described the eternal (sanatana) religious duties of Lord Śiva, to all the gods and ganas, which was summarized in millions of Scriptures. 1-5.
Śiva Dharma Purāṇam 1.8&11.:
हिताय सर्वमर्त्यानां शिवधर्म सनातनम्। येन सिद्धाः सुरा दैत्या गन्धर्वोरगराक्षसाः ॥ 8 ॥
The Śiva Dharma which is beneficial for all mortals is alone Sanātana. By following it, the gods, demons, celestial musicians, serpents, and demons have attained perfection.
परमं सर्वधर्माणां शिवधर्मं शिवो (धि) कम्। शिवेन कथितं पूर्व पार्वत्याः षण्मुखस्य च ॥ 11 ॥
Among all the dharmas, the Dharma of Śiva (Śiva Dharma), which is of Paramēśvara Śiva, is alone Supreme. It was first spoken by Lord Śiva himself to Goddess Parvati and Ṣaṇmukha Kartikeya.
Padma Purana 2.69.3.:
अनंतशाखाकलिताः शिवमूलैकसंश्रिताः । ज्ञानध्यानसुपुष्पाढ्याः शिवधर्माः सनातनाः ॥ ३ ॥
There are said to be infinite branches (sects) in this existence, but Lord Śiva is alone the root of all. The dharma which leads to you Lord Śiva, is only Sanatana, and it is rich in the flowers of the righteous acts, meditation and knowledge.
Rudra Hridayopanishad 1:14.:
"asya trailokyavR^ikshasya bhuumau viTapashaakhinaH | agraM madhya.n tathaa muula.n vishhNubrahmamaheshvaraaH" ||
"This whole creation of Svarga, Martya and Patala Lokas is a big tree. Vishnu is the top portion (branches) of this tree. Brahma is the middle (stem) and the root is Lord Maheshwara".
For more you can see this answer of mine.
I hope this clarifies all your queries. Prd..