Skip to content

Commit

Permalink
Avoid infinite recursion because of keras definition
Browse files Browse the repository at this point in the history
Works around nix-community/poetry2nix#750

> infinite recursion encountered

The issue, as pointed out in
DavHau/mach-nix#470 (comment),
is that nixpkgs defines

```
  Keras = keras;
```

https://github.com/NixOS/nixpkgs/blob/fbb042bc87bc92fc5296b8b151e36970dd996c64/pkgs/top-level/python-aliases.nix

poetry2nix must (somewhere) set `keras` to depend on `Keras` meaning
infinite recursion.

The fix is based on the code in
nix-community/poetry2nix#750 (comment)
  • Loading branch information
dbaynard committed Oct 29, 2022
1 parent af3dcdf commit dbe7493
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,29 @@ let
in
lib.listToAttrs (map (name: { inherit name; value = f name; }) pnames);

withDefaults =
let
inherit (poetry2nix.defaultPoetryOverrides) overrideOverlay;
defaults = {
pre = final: prev: {
keras = null;
Keras = null;
keras_ = prev.keras;
};

post = final: prev: {
keras = prev.keras_;
};
};

in
((overrideOverlay defaults.pre).extend defaults.post).extend;
in

poetry2nix.mkPoetryApplication {
projectDir = ./.;
propagatedBuildInputs = [ diffusion-models ];
overrides = poetry2nix.overrides.withDefaults (withSetuptools [
overrides = withDefaults (withSetuptools [
"libclang"
"pyparsing"
"typing-extensions"
Expand Down

0 comments on commit dbe7493

Please sign in to comment.