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

New experimental nixvim configurations fail without devshell input #2948

Open
HeitorAugustoLN opened this issue Feb 1, 2025 · 9 comments
Open

Comments

@HeitorAugustoLN
Copy link
Member

error:
       … in the left operand of the update (//) operator
         at «nix-internal»/call-flake.nix:69:13:
           68|             # This is shadowed in the next //
           69|             // sourceInfo
             |             ^
           70|             // {

       … while evaluating the attribute 'config.flake'
         at /nix/store/afzapn9d41mhkpw475dcaxwrmcz5yr3m-source/lib/modules.nix:334:9:
          333|         options = checked options;
          334|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          335|         _module = checked (config._module);

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

       error: stack overflow; max-call-depth exceeded
@MattSturgeon
Copy link
Member

Can you share a minimal reproducible example?

@HeitorAugustoLN
Copy link
Member Author

HeitorAugustoLN commented Feb 1, 2025

flake.nix

{
  inputs = {
    flake-parts = {
      url = "github:hercules-ci/flake-parts";
      inputs.nixpkgs-lib.follows = "nixpkgs";
    };
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    nixvim = {
      url = "github:nix-community/nixvim";
      inputs = {
        devshell.follows = "";
        flake-parts.follows = "flake-parts";
        nixpkgs.follows = "nixpkgs";
      };
    };
  };

  outputs =
    inputs:
    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
      systems = [
        "aarch64-darwin"
        "aarch64-linux"
        "x86_64-darwin"
        "x86_64-linux"
      ];

      imports = [ inputs.nixvim.flakeModules.default ];
    
      nixvim = {
        checks.enable = true;
        packages.enable = true;
      };
    
      perSystem =
        {
          self',
          system,
          ...
        }:
        {
          nixvimConfigurations = {
            default = self'.nixvimConfigurations.nvim;
            nvim = inputs.nixvim.lib.evalNixvim {
              inherit system;
              modules = [ ./nvim ];
            };
          };
        };
    };
}

nvim/default.nix

{}

@MattSturgeon
Copy link
Member

Do you still have inf-recursion if you use config instead of self'?

@HeitorAugustoLN
Copy link
Member Author

Do you still have inf-recursion if you use config instead of self'?

Yes

@HeitorAugustoLN
Copy link
Member Author

Maybe this could help: https://flake.parts/dogfood-a-reusable-module? As in the flake-parts documentation says it helps to avoid infinite recursion, but haven't looked into it too see if it this would help in this case.

@MattSturgeon
Copy link
Member

Thanks. I have read that a few times, but re-reading it never hurts 🧐

The inf-recursion discussed there would be relevant if our flake-modules depended on something else from nixvim's flake outputs. However IIRC the modules are self contained.

For reference, @khaneliman has been successfully using the modules in his flake: khaneliman/khanelivim#12. It'd be interesting to see what's different between yours and his implementations.

@HeitorAugustoLN
Copy link
Member Author

In my neovim configuration, it is working fine currently, with the new experimental configurations. I just can't remove the devshell input specifically from the nixvim inputs as I used to before.

@HeitorAugustoLN
Copy link
Member Author

Okay, nevermind, it is not specific to devshell, it also happens when removing git-hooks and treefmt-nix.

@MattSturgeon
Copy link
Member

[it] happens when removing [nixvim's optional flake inputs]

Ah, gotcha. I missed that detail at first.

I'll try and find time to investigate. Otherwise remind me in a few days.

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