-
Notifications
You must be signed in to change notification settings - Fork 42
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 self
assigned to option
#185
Comments
@DavHau which version and platform did that happen? When I run it on x86_64-linux, I get infinite recursions instead, which do have a trace, although the quality of the trace varies between Nix versions. 2.13.3 seems best. Seems like a serious problem indeed. I think we should add This solution may also help with |
The example above results in an infinite recursion for me as well. Let me know if I should publish the dream2nix expression that lead to a stack overflow. |
Could you try with this? PR description shows how to You might be able to tell what's the difference between your original problem and reproducer with it. |
Blocked on NixOS/nix#8908 |
Does #192 help? With it I get: $ nix eval . --override-input flake-parts github:hercules-ci/flake-parts/refs/pull/192/head
warning: not writing modified lock file of flake 'path:/home/user/h/issue-flake-parts-185':
• Updated input 'flake-parts':
'github:hercules-ci/flake-parts/7f53fdb7bdc5bb237da7fefef12d099e4fd611ca' (2023-09-01)
→ 'github:hercules-ci/flake-parts/0effb5db5ccc46f8787c98ca91ec64cc9721c121' (2023-10-13)
error: The option `nixosConfigurations' does not exist. Definition values:
- In `<unknown-file>'
(use '--show-trace' to show detailed location information)
Still an error, as expected, but actionable. Fixing it up a bit: {
outputs = inputs@{flake-parts, nixpkgs, self, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [ "x86_64-linux" ];
flake.nixosConfigurations.default = nixpkgs.lib.nixosSystem {
modules = [
{
# assigning self to a non existent option triggers the infinite recursion
foo.repoRoot = self;
}
];
};
};
} I then get this, simulating $ nix eval .#nixosConfigurations.default.config.system.build.toplevel.drvPath --override-input flake-parts github:hercules-ci/flake-parts/refs/pull/192/head
warning: not writing modified lock file of flake 'path:/home/user/h/issue-flake-parts-185':
• Updated input 'flake-parts':
'github:hercules-ci/flake-parts/7f53fdb7bdc5bb237da7fefef12d099e4fd611ca' (2023-09-01)
→ 'github:hercules-ci/flake-parts/0effb5db5ccc46f8787c98ca91ec64cc9721c121' (2023-10-13)
error: Neither nixpkgs.hostPlatform nor the legacy option nixpkgs.system has been set.
You can set nixpkgs.hostPlatform in hardware-configuration.nix by re-running
a recent version of nixos-generate-config.
The option nixpkgs.system is still fully supported for NixOS 22.05 interoperability,
but will be deprecated in the future, so we recommend to set nixpkgs.hostPlatform.
(use '--show-trace' to show detailed location information) |
Fixed in #192 |
The following flake leads to an infinite recursion:
I think this issue is import to fix.
For example this could as well happen with the treefmt.repoRoot option. If it ever gets deprecated, users will be puzzled by a hard to debug issue.
In my case this lead to a stack overflow with no trace at all.
This does only happen when using flake-parts and not with vanilla flakes.
The text was updated successfully, but these errors were encountered: