https://en.m.wikipedia.org/wiki/Purusha_Sukta
It's interpretation is varied and controversial to say the least.
But one shouldn't confuse the theoretical model presented in the liturgical texts (referred to with the term "varna", meaning "color" or "tone") with the concrete manifestation of traditional endogamous divisions in society (referred to with the term "jati", meaning "station of birth').
The ground reality is more oriented around the complexities of class, tribe, language and occupation, and even physical phenotype, which were then rationalized through the theoretical 4-fold system of caste.
There are parts of India (the southern and eastern parts) where the actual social structure doesn't map as cleanly to the 4-fold system, except among the higher castes. However endogamy and strong caste hierarchy is still just as common in these regions.
In terms of population genetics of South Asia specifically, here is a good place to start:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2702070/#__sec2...