Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template fails with stack overflow #1577

Open
blalor opened this issue Apr 1, 2024 · 2 comments
Open

template fails with stack overflow #1577

blalor opened this issue Apr 1, 2024 · 2 comments

Comments

@blalor
Copy link

blalor commented Apr 1, 2024

Describe the issue

Current master is 3c92540. Running nix develop with the output of nix flake init --template github:nix-community/poetry2nix fails with error: stack overflow; max-call-depth exceeded.

Replacing

myapp = mkPoetryApplication { projectDir = self; };

with

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

fixes the issue.

[~] ➜ pushd $( mktemp -d )
[566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0] ➜ nix flake init --template github:nix-community/poetry2nix
wrote: /private/var/folders/7t/566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0/app/__init__.py
wrote: /private/var/folders/7t/566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0/app
wrote: /private/var/folders/7t/566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0/pyproject.toml
wrote: /private/var/folders/7t/566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0/flake.nix
wrote: /private/var/folders/7t/566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0/poetry.lock
[566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0] ➜ nix develop
warning: creating lock file '/private/var/folders/7t/566c7dz95mv5fndq6gyy661m0000gp/T/tmp.frCB0I42A0/flake.lock':
• Added input 'flake-utils':
    'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11)
• Added input 'flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Added input 'nixpkgs':
    'github:NixOS/nixpkgs/d8fe5e6c92d0d190646fb9f1056741a229980089' (2024-03-29)
• Added input 'poetry2nix':
    'github:nix-community/poetry2nix/3c92540611f42d3fb2d0d084a6c694cd6544b609' (2024-02-22)
• Added input 'poetry2nix/flake-utils':
    'github:numtide/flake-utils/1ef2e671c3b0c19053962c07dbda38332dcebf26' (2024-01-15)
• Added input 'poetry2nix/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Added input 'poetry2nix/nix-github-actions':
    'github:nix-community/nix-github-actions/5163432afc817cf8bd1f031418d1869e4c9d5547' (2023-12-29)
• Added input 'poetry2nix/nix-github-actions/nixpkgs':
    follows 'poetry2nix/nixpkgs'
• Added input 'poetry2nix/nixpkgs':
    follows 'nixpkgs'
• Added input 'poetry2nix/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Added input 'poetry2nix/treefmt-nix':
    'github:numtide/treefmt-nix/e504621290a1fd896631ddbc5e9c16f4366c9f65' (2024-02-19)
• Added input 'poetry2nix/treefmt-nix/nixpkgs':
    follows 'poetry2nix/nixpkgs'
error (ignored): error: end of string reached
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute '__impureHostDeps' of derivation 'nix-shell'
         at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/pkgs/stdenv/generic/make-derivation.nix:443:7:
          442|       __propagatedSandboxProfile = unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
          443|       __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps ++ [
             |       ^
          444|         "/dev/zero"

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: stack overflow; max-call-depth exceeded
       at /nix/store/0pjr31l2hr6jiafi9wiyny5gszylw7c2-source/lib.nix:61:20:
           60|     in
           61|     lib.optionals (builtins.pathExists path && builtins.toString path != "/" && ! isGitRoot) (findGitIgnores parent) ++ gitIgnores;
             |                    ^
           62|

Additional context

flake.nix:

{
  description = "Application packaged using poetry2nix";

  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    poetry2nix = {
      url = "github:nix-community/poetry2nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        # see https://github.com/nix-community/poetry2nix/tree/master#api for more functions and examples.
        pkgs = nixpkgs.legacyPackages.${system};
        inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
      in
      {
        packages = {
          myapp = mkPoetryApplication { projectDir = self; };
          default = self.packages.${system}.myapp;
        };

        devShells.default = pkgs.mkShell {
          inputsFrom = [ self.packages.${system}.myapp ];
          packages = [ pkgs.poetry ];
        };
      });
}

pyproject.toml:

[tool.poetry]
name = "app"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

poetry.lock:

# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
package = []

[metadata]
lock-version = "2.0"
python-versions = "^3.11"
content-hash = "81b2fa642d7f2d1219cf80112ace12d689d053d81be7f7addb98144d56fc0fb2"
@MaeIsBad
Copy link

MaeIsBad commented Apr 8, 2024

This doesn't happen with nix 2.19 on earlier, It only happens with Nix 2.20 or later

@MaeIsBad
Copy link

MaeIsBad commented Apr 8, 2024

I believe this might be the same issue as NixOS/nix#9672

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants