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 error when unknown option is set #193

Closed
khaled opened this issue Oct 27, 2023 · 3 comments
Closed

Infinite recursion error when unknown option is set #193

khaled opened this issue Oct 27, 2023 · 3 comments

Comments

@khaled
Copy link

khaled commented Oct 27, 2023

Setting a top level attribute for which there is no option defined yields an infinite recursion error.

Example:

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs?rev=8efd5d1e283604f75a808a20e6cde0ef313d07d4";
  inputs.flake-parts.url = "github:hercules-ci/flake-parts?rev=c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4";
  outputs = inputs @ {flake-parts, ...}:
    flake-parts.lib.mkFlake {inherit inputs;} {
      systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
      perSystem = {pkgs, ...}: {
        packages.default = pkgs.hello;
      };
      foo.bar = 10;  # set an unknown option
    };
}

Output:

$ nix build

error:
       … in the left operand of the update (//) operator

         at «string»:56:13:

           55|             # This is shadowed in the next //
           56|             // sourceInfo
             |             ^
           57|             // {

       … while evaluating the attribute 'config.flake'

         at /nix/store/r88zkfh22shcgj0c4zh9jj2q5r1z9wjn-source/lib/modules.nix:320:9:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          321|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: infinite recursion encountered

       at «none»:0: (source not available)
@roberth
Copy link
Member

roberth commented Oct 29, 2023

Fixed in #192

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4' (2023-10-03)
  → 'github:hercules-ci/flake-parts/25abf6caa8e0c30e1e755eb384fd230316985121' (2023-10-29)

$ nix flake check
warning: Git tree '/tmp/flake-parts-193' is dirty
error: The option `foo' does not exist. Definition values:
       - In `<unknown-file>':
           {
             bar = 10;
           }
(use '--show-trace' to show detailed location information)

I'm surprised to see <unknown-file> still, but the error is now relevant.

@roberth roberth closed this as completed Oct 29, 2023
@roberth
Copy link
Member

roberth commented Oct 29, 2023

surprised to see <unknown-file> still

Fixed in #194

@khaled
Copy link
Author

khaled commented Oct 30, 2023

much appreciated @roberth!

shymega pushed a commit to shymega/flake-parts that referenced this issue Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants