DavHau / mach-nix

Create highly reproducible python environments
MIT License
861 stars 106 forks source link

Infinite recursion encountered when building a python package #470

Open rihardsk opened 2 years ago

rihardsk commented 2 years ago

Here's a part of the trace from nix-build:

error: infinite recursion encountered

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:311:7:

          310|       depsBuildBuild              = lib.elemAt (lib.elemAt dependencies 0) 0;
          311|       nativeBuildInputs           = lib.elemAt (lib.elemAt dependencies 0) 1;
             |       ^
          312|       depsBuildTarget             = lib.elemAt (lib.elemAt dependencies 0) 2;

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-python-dateutil-2.8.2'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'python3.9-freezegun-1.2.1'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-babel-2.10.1'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'python3.9-Jinja2-3.1.2'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-pyparsing-3.0.9'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'python3.9-packaging-21.3'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'python3.9-setuptools-scm-6.4.2'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-pytest-7.1.1'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-mock-4.0.3'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-flaky-3.7.0'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-pyopenssl-22.0.0'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'dev.outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:204:13:

          203|             drvPath = assert condition; drv.${outputName}.drvPath;
          204|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          205|           };

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-uvloop-0.16.0'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'outPath'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/customisation.nix:211:7:

          210|       drvPath = assert condition; drv.drvPath;
          211|       outPath = assert condition; drv.outPath;
             |       ^
          212|     };

       … while evaluating 'updatePythonDeps'

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:52:31:

           51|         inputs;
           52|   updatePythonDeps = newPkgs: pkg:
             |                               ^
           53|     if ! isPyModule pkg then pkg else

       … from call site

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:67:57:

           66|   updateAndRemoveDeps = pythonSelf: name: inputs:
           67|     removeUnwantedPythonDeps pythonSelf name (map (dep: updatePythonDeps pythonSelf dep) inputs);
             |                                                         ^
           68|   cleanPythonDerivationInputs = pythonSelf: name: oldAttrs:

       … while evaluating anonymous lambda

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:67:52:

           66|   updateAndRemoveDeps = pythonSelf: name: inputs:
           67|     removeUnwantedPythonDeps pythonSelf name (map (dep: updatePythonDeps pythonSelf dep) inputs);
             |                                                    ^
           68|   cleanPythonDerivationInputs = pythonSelf: name: oldAttrs:

       … from call site

       … while evaluating 'isPyModule'

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:15:16:

           14|   pkgsData = fromJSON ''{"aiohttp": {"name": "aiohttp", "ver": "3.8.1", "build_inputs": [], "prop_build_inputs": ["multidict", "charset-normalizer", "aiosignal", "frozenlist", "async-timeout", "yarl", "attrs"], "is_root": true, "provider_info": {"provider": "wheel", "wheel_fname": "aiohttp-3.8.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "aiosignal": {"name": "aiosignal", "ver": "1.2.0", "build_inputs": [], "prop_build_inputs": ["frozenlist"], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "aiosignal-1.2.0-py3-none-any.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "async-timeout": {"name": "async-timeout", "ver": "4.0.2", "build_inputs": [], "prop_build_inputs": [], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "async_timeout-4.0.2-py3-none-any.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "asyncpg": {"name": "asyncpg", "ver": "0.25.0", "build_inputs": [], "prop_build_inputs": [], "is_root": true, "provider_info": {"provider": "sdist", "wheel_fname": null, "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "attrs": {"name": "attrs", "ver": "21.4.0", "build_inputs": [], "prop_build_inputs": [], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "attrs-21.4.0-py2.py3-none-any.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "charset-normalizer": {"name": "charset-normalizer", "ver": "2.0.11", "build_inputs": [], "prop_build_inputs": [], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "charset_normalizer-2.0.11-py3-none-any.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "commonmark": {"name": "commonmark", "ver": "0.9.1", "build_inputs": [], "prop_build_inputs": [], "is_root": true, "provider_info": {"provider": "wheel", "wheel_fname": "commonmark-0.9.1-py2.py3-none-any.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "frozenlist": {"name": "frozenlist", "ver": "1.3.0", "build_inputs": [], "prop_build_inputs": [], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "frozenlist-1.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "idna": {"name": "idna", "ver": "3.3", "build_inputs": [], "prop_build_inputs": [], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "idna-3.3-py3-none-any.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "mautrix": {"name": "mautrix", "ver": "0.16.3", "build_inputs": null, "prop_build_inputs": null, "is_root": true, "provider_info": {"provider": "nixpkgs", "wheel_fname": null, "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "multidict": {"name": "multidict", "ver": "6.0.2", "build_inputs": [], "prop_build_inputs": [], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "multidict-6.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "protobuf": {"name": "protobuf", "ver": "3.19.4", "build_inputs": [], "prop_build_inputs": [], "is_root": true, "provider_info": {"provider": "wheel", "wheel_fname": "protobuf-3.19.4-cp39-cp39-manylinux2014_aarch64.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "python-magic": {"name": "python-magic", "ver": "0.4.26", "build_inputs": null, "prop_build_inputs": null, "is_root": true, "provider_info": {"provider": "nixpkgs", "wheel_fname": null, "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "ruamel.yaml": {"name": "ruamel.yaml", "ver": "0.17.17", "build_inputs": [], "prop_build_inputs": ["ruamel.yaml.clib"], "is_root": true, "provider_info": {"provider": "wheel", "wheel_fname": "ruamel.yaml-0.17.17-py3-none-any.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "ruamel.yaml.clib": {"name": "ruamel.yaml.clib", "ver": "0.2.2", "build_inputs": [], "prop_build_inputs": [], "is_root": false, "provider_info": {"provider": "wheel", "wheel_fname": "ruamel.yaml.clib-0.2.2-cp39-cp39-manylinux2014_aarch64.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "setuptools": {"name": "setuptools", "ver": "61.2.0", "build_inputs": null, "prop_build_inputs": null, "is_root": true, "provider_info": {"provider": "nixpkgs", "wheel_fname": null, "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}, "yarl": {"name": "yarl", "ver": "1.7.2", "build_inputs": [], "prop_build_inputs": ["idna", "multidict"], "is_root": true, "provider_info": {"provider": "wheel", "wheel_fname": "yarl-1.7.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", "url": null, "hash": null}, "extras_selected": [], "removed_circular_deps": [], "build": null}}'';
           15|   isPyModule = pkg:
             |                ^
           16|     isAttrs pkg && hasAttr "pythonModule" pkg;

       … from call site

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:47:16:

           46|         (dep:
           47|           if ! isPyModule dep || pkgsData ? "${normalizeName (get_pname dep)}" then
             |                ^
           48|             true

       … while evaluating anonymous lambda

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:46:10:

           45|       filter
           46|         (dep:
             |          ^
           47|           if ! isPyModule dep || pkgsData ? "${normalizeName (get_pname dep)}" then

       … from call site

       … while evaluating 'removeUnwantedPythonDeps'

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:36:49:

           35|   ];
           36|   removeUnwantedPythonDeps = pythonSelf: pname: inputs:
             |                                                 ^
           37|     # Do not remove any deps if provider is nixpkgs and actual dependencies are unknown.

       … from call site

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:67:5:

           66|   updateAndRemoveDeps = pythonSelf: name: inputs:
           67|     removeUnwantedPythonDeps pythonSelf name (map (dep: updatePythonDeps pythonSelf dep) inputs);
             |     ^
           68|   cleanPythonDerivationInputs = pythonSelf: name: oldAttrs:

       … while evaluating 'updateAndRemoveDeps'

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:66:43:

           65|       newP;
           66|   updateAndRemoveDeps = pythonSelf: name: inputs:
             |                                           ^
           67|     removeUnwantedPythonDeps pythonSelf name (map (dep: updatePythonDeps pythonSelf dep) inputs);

       … from call site

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:69:48:

           68|   cleanPythonDerivationInputs = pythonSelf: name: oldAttrs:
           69|     mapAttrs (n: v: if elem n depNamesAll then updateAndRemoveDeps pythonSelf name v else v ) oldAttrs;
             |                                                ^
           70|   override = pkg:

       … while evaluating anonymous lambda

       at /nix/store/idj6rrr4mvyr2hlyh6al2xlcxn9byd3v-mach_nix_file/share/mach_nix_file.nix:69:18:

           68|   cleanPythonDerivationInputs = pythonSelf: name: oldAttrs:
           69|     mapAttrs (n: v: if elem n depNamesAll then updateAndRemoveDeps pythonSelf name v else v ) oldAttrs;
             |                  ^
           70|   override = pkg:

       … from call site

       … while evaluating 'optionals'

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/lib/lists.nix:271:5:

          270|     # List to return if condition is true
          271|     elems: if cond then elems else [];
             |     ^
          272|

       … from call site

       at /nix/store/dcmazdpj0zf3s9rd40d6vmhxhs6gv8dl-source/pkgs/stdenv/generic/make-derivation.nix:216:13:

          215|          ++ lib.optionals doCheck checkInputs
          216|          ++ lib.optionals doInstallCheck' installCheckInputs))
             |             ^
          217|       (map (drv: drv.__spliced.buildTarget or drv) (checkDependencyList "depsBuildTarget" depsBuildTarget))

       … while evaluating 'chooseDevOutputs'

Encountered when building this thing

{ pkgs ? null }:
let
  mach-nix-src = builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix";
    ref = "refs/tags/3.5.0";
    rev = "7e14360bde07dcae32e5e24f366c83272f52923f";
  };
  mach-nix = if pkgs == null
             then import mach-nix-src {}
             else import mach-nix-src { inherit pkgs; };

  customPython = mach-nix.mkPython {
    packagesExtra = [
      mautrix-googlechat
    ];

    # ${file}/lib/libmagic is the native library that python_magic relies on
    # _.python-magic.buildInputs.add = [ mach-nix.nixpkgs.file ];
    # Dunno how to get the above working, so here's an alternative approach
    providers.python-magic = "nixpkgs";
  };

  mautrix-googlechat = mach-nix.buildPythonPackage {
    pname = "mautrix-googlechat";
    version = "0.3.3";
    src = fetchTarball {
      # TODO: would love to use this, but then we have to update mautrix (which
      # involves updating flake.lock for mach nix and we need to switch to
      # flakes for that probably)
      #
      # url = "https://github.com/mautrix/googlechat/tarball/53a2b6b6492911410b73e62a6e42e4311ec98d38";
      # sha256 = "14ll27njnl7miisbdwcrlynpxx9npzs23mslc3v8gqvdk06hf0bi";
      url = "https://github.com/mautrix/googlechat/tarball/9cd6385924867d123406b7d6b06ca8ac4e6d0f00";
      sha256 = "0328y9cb9824p3szydfk4pqd9a6f3p7xibdcd8mw7rqabr8f6a9g";
    };
    requirements = ''
      aiohttp>=3,<4
      yarl>=1,<2
      asyncpg>=0.20,<0.26
      ruamel.yaml>=0.15.94,<0.18
      commonmark>=0.8,<0.10
      python-magic>=0.4,<0.5
      protobuf>=3,<4
      mautrix>=0.16.3,<0.17
      setuptools
    '';
    providers.python-magic = "nixpkgs";
    # Don't know why but `doCheck` seems to not be doing anything here but
    # `tests`, which, afaik, isn't a standard `buildPythonPackage` attr, is
    # doCheck = true;
    tests = true;
  };
in

mautrix-googlechat.overridePythonAttrs (old: {
  # Took inspiration from mautrix-facebook in nixpkgs

  postInstall = ''
    mkdir -p $out/bin

    cat <<-END >$out/bin/mautrix-googlechat
    #!/bin/sh
    PYTHONPATH="$PYTHONPATH" exec ${customPython.python}/bin/python -m mautrix_googlechat "\$@"
    END
    chmod +x $out/bin/mautrix-googlechat
  '';

  checkPhase = ''
    $out/bin/mautrix-googlechat --help
  '';
})

Started happening after I switched from mach-nix 3.4.0 to 3.5.0 and updated the source I was building.

gador commented 2 years ago

I got something similar with babel

My error is:

error: infinite recursion encountered

       at /nix/store/pxf5kjsydf0rrb4kkmn5g92xjqx51kzy-nixpkgs/pkgs/top-level/python-aliases.nix:41:11:

           40|   asyncio-nats-client = nats-py; # added 2022-02-08
           41|   Babel = babel; # added 2022-05-06
             |           ^
           42|   bitcoin-price-api = throw "bitcoin-price-api has been removed, it was using setuptools 2to3 translation feautre, which has been removed in setuptools 58"; # added 2022-02-15
(use '--show-trace' to show detailed location information)

I guess mach-nix isn't case-sensitive here?

cscutcher commented 2 years ago

@gador I'm seeing that issue too, and while the error does look the same, I think the cause might be different.

I think the root of the problem you and I are seeing is that python-aliases.nix in the official nixpkgs added the alias from Babel to babel (it is case sensitive). However, in the generated overrides that mach-nix creates during build, it does;

    "babel" = override python-super."Babel" ( ... )

which means that Babel refers to babel which refers to Babel 💥😭.

I'm no expert when it comes to nix though, and mach-nix is super clever, but pretty complicated so I could definitely be wrong. If someone who knows better can confirm, then I'll create a different issue for the problem @gador and me are seeing. (My full trace output is in this gist)

(@gador I did poke around trying to work around the problem but didn't have much luck. That being said, if you are able to pin to a version of nixpkgs before 2022-05-06 you can probably avoid the issue if that helps. Unfortunately for me I need to be on a newer nixpkgs for other reasons 😔 )

cscutcher commented 1 year ago

I happened to come across this again today. Setting this for the overridesPre;

    overridesPre = [
      (self: super: {
        _babel = super.babel;
      })
    ];

and overridesPost to include;


    overridesPost = [
      (self: super: {
        babel = self._babel;
        Babel = self._babel;
      })
    ];
``

helped as a workaround
cscutcher commented 1 year ago

Worth pointing out this bug can also look more like this;

 nix build
warning: Git tree '/home/asymmetric/code/foo/bar' is dirty
error: infinite recursion encountered

       at /nix/store/8gwzhqn67qm8r5biakx2hxsqiy3jfqmz-source/lib/attrsets.nix:312:41:

          311|   */
          312|   nameValuePair = name: value: { inherit name value; };
             |                                         ^
          313|
(use '--show-trace' to show detailed location information)

from https://github.com/nix-community/poetry2nix/issues/750 (thanks lelit for linking to that issue!)