What kind of templating are we talking about? HTML or in general?
If we take python, for example, you could use jinja for HTML and composition/inheritance for the general stuff.
That's all django does, and it does it well. I don't see what nix is doing so much better.
Prefer JS/TS? You can have JSX, which is superior in any way compared to this nix-based abomination.