How to troubleshoot an infinite recursion error?

For better or worse, my habit when I need a flake.nix is to find two (or more) which do what I need and then place their contents in a single file, deleting fragments here or there until I have merged them into a single valid flake.

I was doing that when I came up with this one:

To replicate the behavior I’m talking about, run this:

nix build 'github:MatrixManAtYrService/bug-2023-09-03'

On one machine, it just hangs for a while and then my terminal closes. On another, it takes 20 minutes and then fails like this:

evaluating derivation 'github:MatrixManAtYrService/bug-2023-09-03#packages.x86_64-linux.default'error: stack overflow (possible infinite recursion)

How can I capture more information about this failure? Is it a problem with my flake, or a problem with poetry2nix? If the latter, what kind of info should I collect for a bug report?

Thanks in advance!

My guess is that the problem is in this line:

myapp = mkPoetryApplication { projectDir = self; };

Maybe you could try something like this:

myapp = mkPoetryApplication { projectDir = ./.; };

I wondered about that too, but that shouldn’t change anything, and the self is verbatim from the poetry2nix template (as is most of this mini flake):

Either nobody ever tested that template or this is a nix bug.

Hey guys, thanks for taking a look. I encountered the same error with this change:

-        myapp = mkPoetryApplication { projectDir = self; };
+        myapp = mkPoetryApplication { projectDir = ./.; };

So I think it’s something else.

I had the same problem. This is what fixed it for me: PSA: poetry2nix is currently broken with nixpkgs-unstable

more information there: