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

Infinite recursion encountered #43

Closed
robertodr opened this issue Feb 25, 2023 · 9 comments · Fixed by #58
Closed

Infinite recursion encountered #43

robertodr opened this issue Feb 25, 2023 · 9 comments · Fixed by #58
Labels
bug Something isn't working properly

Comments

@robertodr
Copy link

I've been trying to update my flake setup to use the latest version of stylix, but I keep hitting an infinite recursion:

error: infinite recursion encountered

       at /nix/store/f6jk9gi6i92ngcbkcz8z2d7gvkksciw1-source/lib/modules.nix:728:9:

          727|     in warnDeprecation opt //
          728|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          729|         inherit (res.defsFinal') highestPrio;
(use '--show-trace' to show detailed location information)

Using --show-trace doesn't help much in finding the reason unfortunately.
This is the latest revision of stylix that works for me: d7536947a7fc3f9b60ba3c8f19c2530ca00110a9. I'm using digga to structure my configuration (you can find it here) I define the theme in this file which I then import in the definition of the user

@danth danth added the bug Something isn't working properly label Feb 25, 2023
@dwarfmaster
Copy link
Contributor

I'm trying to reproduce your problem, how should I build your config ? I've tried a nix flake show but I get an error when evaluatiing checks.

@robertodr
Copy link
Author

I usually use nixos-rebuild: sudo nixos-rebuild --flake .#captain-easychord build

@dwarfmaster
Copy link
Contributor

dwarfmaster commented Feb 28, 2023

Ok so after some experimentation, there are two things that both cause infinite recursion, but I don't yet know why:

  • In stylix/nixos/palette.nix, setting stylix/palette.html (that one actually works)
  • In modules/gnome/nixos.nix, setting the overlay

@dwarfmaster
Copy link
Contributor

In modules/gnome/nixos.nix, even setting nixpkgs.overlays to [] cause the infinite recursion, but setting it from stylix/nixos/default.nix does not cause any trouble. So it might be something linked to the interaction of nixpkgs.overlays and mkIf. However, I didn't encounter this problem on my config, it probably is linked to something digga is doing.

@dwarfmaster
Copy link
Contributor

Ok so my hypothesis is that digga use the value of nixpkgs.overlays and nixpkgs.pkgs to build the lib argument it gives to the modules (I don't have the time right now to dive into the implementation details of digga to make sure of that). That means that anything using lib needs first to evaluate config.nixpkgs.overlays, which in our case need to evaluate lib.mkIf, creating the infinite recursion.
That would explain why I haven't encountered this bug, since my lib argument comes from outside the module system.
I am not sure how to fix it however, I would have to think a bit more about it.

@dwarfmaster
Copy link
Contributor

I confirmed that if the mkIf comes from outside, there is no more infinite recursion, but I'm not sure how to do that properly.
Maybe it would be best if we simply avoided setting nixpkgs.overlays, since anyway the user may discard it by passing pkgs as an argument to nixosSystem. @danth do you think it would be possible to theme gnome without it ?

@robertodr
Copy link
Author

Thank you so much for digging through this! Would opening an issue on the digga repository help?

@dwarfmaster
Copy link
Contributor

Maybe that's the best thing to do indeed. I will create a FAQ here in case someone else encounters the same problems, because it is not specific to digga.

@danth
Copy link
Owner

danth commented Mar 1, 2023

do you think it would be possible to theme gnome without it ?

Once logged in, yes, but I couldn't find any other way to theme GDM as it doesn't load extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants