nix-community / nixos-generators

Collection of image builders [maintainer=@Lassulus]
MIT License
1.72k stars 132 forks source link

Integration with flake-parts seems to cause an infinite recursion #349

Closed Kreyren closed 1 month ago

Kreyren commented 1 month ago

Referencing: https://github.com/NiXium-org/NiXium/pull/118#issuecomment-2221882643

I am trying to declare the nixosGenerator with a workaround for https://github.com/NixOS/nixpkgs/issues/286196 as a module (so that it can be used for other things) to be able to declare it as a package (to be able to set up a CI/CD to produce the build and additional management) so that it can be declared as an app for nix run.

Where using packages.aarch64-linux.nixos-tsvetan-recovery = self.inputs.nixos-generators.nixosGenerate seems to cause an infinite recursion when used with flake-parts, i was discussing this in NixOS room where it was suggested to be a nixos-generator bug, thus filing this issue.

DavHau commented 1 month ago

you put a flake. prefix in front of your declaration, so it becomes flake.packages.aarch64-linux.nixos-tsvetan-recovery = ....

It is weird that flake parts crashes with an infinite recursion because of that. Maybe report this at flake-parts.

Kreyren commented 1 month ago

It causes infinite recursion even with the flake. prefix removed from relevant configuration NiXium-org/NiXium@0919224 (#118)

Cross-Referencing: https://github.com/hercules-ci/flake-parts/issues/236

DavHau commented 1 month ago

@Kreyren the other declarations in the file also need to be prefixed with flake.. I tried is yesterday and it worked

Kreyren commented 1 month ago

@DavHau Thanks a lot! <3 i think i made it work, it seems to trigger an infinite recursion when the option is called without a flake or when the option fails to evaluate, so probably unrelated to nixos-generators.