gmodena / nix-flatpak

Install flatpaks declaratively
Apache License 2.0
276 stars 10 forks source link

Warn users of the infinite recursion bug in home-manager. #25

Closed nikp123 closed 2 weeks ago

nikp123 commented 8 months ago

Basically when importing an home-manager module outside of where you imported home-manager itself, you'll experience something like akin to this: https://github.com/GermanBread/declarative-flatpak/issues/9

I know that some people will run into this exact same issue, so it's better to warn them instead of leaving them with a confusing message.

gmodena commented 8 months ago

hey @nikp123 . Thanks for the heads up. I did not stumbled upon this bug yet.

I'll have a link to the issue your linked and try to reproduce. Do you maybe have a snippet with a buggy nix-flatpak config? Though it might be a more general home-manager thing.

nikp123 commented 8 months ago

hey @nikp123 . Thanks for the heads up. I did not stumbled upon this bug yet.

I'll have a link to the issue your linked and try to reproduce. Do you maybe have a snippet with a buggy nix-flatpak config? Though it might be a more general home-manager thing.

IIRC, it's a home-manager thing. Apparently importing home-manager modules is scope specific due to a bug. IMO it's better to inform, just in case.

To reproduce the issue, you'll have to:

  1. put this or any other flake home-manager module as a flake input
  2. import your home-manager instance in a (example) home.nix file
  3. in that home.nix file you will import a file (example) home-subconfig.nix
  4. and in that file you'll import this or any other home-manager module. This fails.
nikp123 commented 8 months ago

Here's the original issue in case you haven't found it: https://github.com/nix-community/nixvim/issues/83

gmodena commented 8 months ago

IIRC, it's a home-manager thing. Apparently importing home-manager modules is scope specific due to a bug. IMO it's better to inform, just in case.

To reproduce the issue, you'll have to:

1. put this or any other flake home-manager module as a flake input

2. import your home-manager instance in a (example) `home.nix` file

3. in that `home.nix` file you will import a file (example) `home-subconfig.nix`

4. and in that file you'll import this or any other home-manager module. **This fails.**

hey @nikp123, thanks for this. I was able to reproduce. As far as I can tell, nesting hm imports results in circular dependencies that breaks with an infinite recursion.

I added a warning to the README, hope this helps.

Let's keep this issue open as a way to further document workarounds / fixes.