Nix' stack size is quite limited for a functional language. You cannot have infinite lists either. IIRC it does not do any tail call optimisation; it's a simple recursive evaluation.
Note that Nix is not a general purpose programming language that is designed to solve general purpose problems such as this one.