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 when migrating my config #16

Open
Lyndeno opened this issue Jun 22, 2023 · 8 comments
Open

Infinite recursion when migrating my config #16

Lyndeno opened this issue Jun 22, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@Lyndeno
Copy link

Lyndeno commented Jun 22, 2023

I am not sure whether this is a problem with how I originally set up my config, haumea, or a combination of the two. In certain spots, especially when referring to config I get infinite recursion just when migrating a line from my original config to a folder that haumea is loading. Oddly, this recurision is solved by lib.mkForce but it feels hacky.

Some examples:

Just specifying which package vscodium module should use.
Lyndeno/nix-config@4add99c

+ # FIXME: Why do I need mkForce to avoid recursion?
+ package = lib.mkForce pkgs.vscodium;

Referencing config to get the proper kernel.
Lyndeno/nix-config@c98095a

# Haumea file
+  # FIXME: For some reason mkForce is needed to prevent infinite recursion
+  kernelPackages = lib.mkForce config.boot.zfs.package.latestCompatibleLinuxPackages;

# Old file
-  boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;

And in this case, not even referencing config, just changing the kernel.
Lyndeno/nix-config#dda0cc2

# FIXME: For some reason mkForce is needed to prevent infinite recursion
 kernelPackages = lib.mkForce pkgs.linuxPackages_rpi4; # Raspberry pies have a hard time booting on the LTS kernel.

In all these cases, the original line worked fine before migrating it to my haumea layout. I am not sure if maybe I am loading the folder in a non-ideal way, or if the way haumea works makes recursion more likely with the way I am configuring my system. The most puzzling cases to me are the ones where I am just changing the kernel package or the vscode package, not something I would expect to cause recursion. I am wondering if anyone has any idea how to fix these errors without resorting to mkForce.

Maybe this is not the right spot to post this problem, but I thought since I am running into this when converting my configs with haumea, maybe someone here could provide valuable insight.

Thank you for the very nice tool! It is allowing me to clean and organize my configs very nicely.

@figsoda
Copy link
Member

figsoda commented Jun 22, 2023

The issue seems to stem from hoistLists, by removing it I was able to fix some of the issues

@Lyndeno
Copy link
Author

Lyndeno commented Jun 22, 2023

Very interesting, seems to have fixed my issues as well. Luckily I wasn't using it for too much. Would this be a bug?

@figsoda
Copy link
Member

figsoda commented Jun 22, 2023

I think something in hoistLists's implementation might be not lazy enough, so I would say yes

@figsoda
Copy link
Member

figsoda commented Jun 22, 2023

I made a minimal reproducible example to make this a little more debuggable

https://github.com/figsoda/haumea-16-repro/blob/main/flake.nix

@figsoda
Copy link
Member

figsoda commented Jun 22, 2023

@blaggacao since you wrote hoistLists, do you have any idea what could be going on?

@figsoda figsoda added the bug Something isn't working label Jun 22, 2023
@blaggacao
Copy link
Contributor

Thanks for the context! I'll have a look asap.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/haumea-filesystem-based-module-system-for-nix/26902/20

@nilp0inter
Copy link

I don't know if it is the same issue or not, but I am encountering infinite recursions as well.

I am also using hoistList. The problem appears when trying to use config as part of the key on any attribute set, i.e:

{
   fileSystem."${config.one-of-my-options}".value = "..."
}

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

No branches or pull requests

5 participants