This overlay is specified as part of the config that nixpkgs naturally looks for, right? so when you import the special nixpkgs, it also loads this overlay, hence infinite recursion. The content of the overlay depends on the content of the overlay. (This is why I prefer flakes )
I don’t see a straightforward solution without changing the way you’re accessing and configuring nixpkgs normally, unless there’s a nixpkgs config option you could specify to the specially-imported nixpkgs that tells it to ignore local config.
According to the nixpkgs manual, it seems like passing { overlays = []; } instead of {} to the imported nixpkgs should override its automatic searching for overlays.
Yeah, it certainly seems like flakes are the better way forward. I’ve held back on that so far partly because they’re still experimental (although it sounds like they’re pretty stable at this point?), but mostly because I haven’t yet taken the time to wrap my head around them and figure out how to migrate my config.
Fairly stable, for simple usecases. Complex input dependency structures, especially when the use of follows is involved, still have some bugs. The bigger problems that still need solving are more to do with establishing best practices that work well in terms of exactly how you expose functionality in the outputs. The current output schema has some significant deficiencies, like the inability to configure the nixpkgs instance used by a flake providing a package, or provide your own already-evaluated instance.