nix-community / poetry2nix

Convert poetry projects to nix automagically [maintainer=@adisbladis,@cpcloud]
MIT License
826 stars 432 forks source link

Infinite recursion #563

Open ppom0 opened 2 years ago

ppom0 commented 2 years ago

Hi, I'm trying to build a poetry application with poetry2nix on NixOS unstable. Here's the nix file:

{ lib, pkgs, poetry2nix }:

let
  repo = fetchGit {
    url = "https://dev.funkwhale.audio/funkwhale/funkwhale.git";
    rev = "4e1c625c242dc44bf7a12922540c0b465a785f8c";
  };
in poetry2nix.mkPoetryApplication {
  name = "funkwhale-api";
  version = "unstable-2022-03-02";

  projectDir = repo + "/api/";

  meta = with lib; {
    homepage = "https://funkwhale.audio";
    description = "A social platform to enjoy and share music";
    license = licenses.agpl3;
  };
}

Here's my shell:

$ nix-build -E "with import <nixpkgs> {}; callPackage ./default.nix {}"
error: stack overflow (possible infinite recursion)

I really don't see any recursion in my own code, so I'm guessing the recursion happens in the poetry2nix nix code? Thanks for help!

ppom0 commented 2 years ago

I see that a similar issue already happened in #538. Is there a tool to look for a circular dependency?

yajo commented 2 years ago

I'm fixing one infinite recursion problem in #585. Might be your problem too?

Is there a tool to look for a circular dependency?

Nope. It's a total nightmare to debug these problems. Please upvote https://github.com/NixOS/nix/issues/6361.

ppom0 commented 2 years ago

I'm not fluent with Nix yet, would you provide a way to test the PR version of poetry2nix in my code? I couldn't manage to install it.

yajo commented 2 years ago

Are you using flakes?

ppom0 commented 2 years ago

Usually no, but they're activated in my nix conf, so I'm ready to do so.

yajo commented 2 years ago

If you use them, then just point the flake input for poetry2nix to github:nix-community/poetry2nix/refs/pull/585/head. Then nix flake update and execute it. If you use the overlay, it will contain my patch.

ppom0 commented 1 year ago

I'm now using poetry2nix 1.37.0 and the same infinite recursion sadly still applies. Might be a duplicate of https://github.com/nix-community/poetry2nix/issues/850 and https://github.com/nix-community/poetry2nix/issues/674

bobvanderlinden commented 1 year ago

There has been a fix merged already in https://github.com/nix-community/poetry2nix/pull/589. However I still run into this error when calling cleanPythonSources.

One thing out-of-the-ordinary for my repository is that it is a mono-repo. The flake is not in the root of git and there are multiple .gitignore to look for.

ppom0 commented 1 year ago

Same for my use-case, but I don't have a nested .gitignore in the directory that holds python code.