Mishneh Torah — Positive Mitzvot מצוות עשה, Chapter 93
The full Hebrew text of Mishneh Torah, Positive Mitzvot, Chapter 93, with English translation by Maimonides (Rambam).
לגלח הנזיר שיערו על קרבנותיו במלאות ימי נזרו, או בתוך ימי נזרו אם נטמא, שנאמר: "וכי ימות מת עליו" (במדבר ו,ט).
For a Nazarite to shave his hair when bringing his sacrifices at the conclusion of his term as a Nazirite, or during his Nazirite term if he becomes impure, as [Numbers 6:9] states: "Should a person die in his presence,... [he must shave....]"