nix-community / nixvim

Configure Neovim with Nix! [maintainer=@GaetanLepage, @traxys, @mattsturgeon]
https://nix-community.github.io/nixvim
MIT License
1.38k stars 208 forks source link

[BUG] error: expected a set but found a list #1702

Open LudovicoPiero opened 2 weeks ago

LudovicoPiero commented 2 weeks ago
Field Description
Plugin lsp
Nixpkgs unstable
Home Manager unstable

Description

Error after doing nix flake update. Here's the error message

error:
       … while calling the 'head' builtin
         at /nix/store/m8869v1img6mqn1d52dyp75v4f3sf1qy-source/lib/attrsets.nix:1575:11:
         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while evaluating the attribute 'value'
         at /nix/store/m8869v1img6mqn1d52dyp75v4f3sf1qy-source/lib/modules.nix:809:9:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/m8869v1img6mqn1d52dyp75v4f3sf1qy-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `warnings':

       … while evaluating definitions from `/nix/store/m8869v1img6mqn1d52dyp75v4f3sf1qy-source/nixos/modules/system/boot/systemd.nix':

       … while evaluating the option `systemd.services.home-manager-airi.serviceConfig':

       … while evaluating definitions from `/nix/store/cx36lz9m7vv8qznmvxkzg2bs4hlgpqgf-source/src/transformers/nixosConfigurations.nix':

       … while evaluating the option `home-manager.users.airi.home.file.".manpath".source':

       … while evaluating definitions from `/nix/store/6nfmqa5gw9gs1wbxfw9p0qpk5apblb7g-source/modules/files.nix':

       … while evaluating the option `home-manager.users.airi.home.file.".manpath".text':

       … while evaluating definitions from `/nix/store/6nfmqa5gw9gs1wbxfw9p0qpk5apblb7g-source/modules/programs/man.nix':

       … while evaluating the option `home-manager.users.airi.programs.nixvim.content':

       … while evaluating definitions from `/nix/store/fg9vjx7bl5yj0slbwgw1rjghmlvvi83f-source/modules/output.nix':

       … while evaluating the option `home-manager.users.airi.programs.nixvim.extraConfigLua':

       … while evaluating definitions from `/nix/store/fg9vjx7bl5yj0slbwgw1rjghmlvvi83f-source/plugins/lsp':

       … while evaluating the option `home-manager.users.airi.programs.nixvim.plugins.lsp.servers.rust-analyzer.settings':

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

       error: expected a set but found a list: [ { properties = { "rust-analyzer.cargoRunner" = { type = [ "null" "string" ]; default = null; description = "Custom cargo runner extension ID."; }; "rust-analyzer.discoverProjectRunner" = { type = [ "null" "string" ]; default = null; markdownDescription = "Sets the extension responsible for determining which extension the rust-analyzer extension uses to generate `rust-project.json` files. This should should only be used\n if a build system like Buck or Bazel is also in use."; }; "rust-analyzer.restartServerOnConfigChange" = { type = "boolean"; default = false; «4294967289 attributes elided» }; «4294967292 attributes elided» }; «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } «154 items elided» ]

Minimal, Reproducible Example (MRE)

programs.nixvim = {
    plugins = {
      lsp = {
        enable = true;
        servers = {
          rust-analyzer = {
            enable = true;
            filetypes = [ "rs" ];
            installCargo = true;
            installRustc = true;

            settings = {
              diagnostics = {
                enable = true;
                # experimental.enable = true;
                styleLints.enable = true;
              };

              files = {
                excludeDirs = [
                  ".direnv"
                  "rust/.direnv"
                ];
              };

              inlayHints = {
                bindingModeHints.enable = true;
                closureStyle = "rust_analyzer";
                closureReturnTypeHints.enable = "always";
                discriminantHints.enable = "always";
                expressionAdjustmentHints.enable = "always";
                implicitDrops.enable = true;
                lifetimeElisionHints.enable = "always";
                rangeExclusiveHints.enable = true;
              };

              procMacro = {
                enable = true;
              };
            };
          };
        };
      };
    };
 };
}
MattSturgeon commented 2 weeks ago

The error is that a list has been assigned to plugins.lsp.servers.rust-analyzer.settings, however that doesn't appear to be anywhere obvious in your config 🤔 The actual value assigned looks like it's come from our update script:

[ { properties = { "rust-analyzer.cargoRunner" = { type = [ "null" "string" ]; default = null; description = "Custom cargo runner extension ID."; }; "rust-analyzer.discoverProjectRunner" = { type = [ "null" "string" ]; default = null; markdownDescription = "Sets the extension responsible for determining which extension the rust-analyzer extension uses to generate `rust-project.json` files. This should should only be used\n if a build system like Buck or Bazel is also in use."; }; "rust-analyzer.restartServerOnConfigChange" = { type = "boolean"; default = false; «4294967289 attributes elided» }; «4294967292 attributes elided» }; «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } { «4294967286 attributes elided» } «154 items elided» ]

Without looking into this properly, my first thought is that one of my recent refactoring PRs broke something here.

LudovicoPiero commented 2 weeks ago

Actually, it's only happening on nixos-unstable-small. On nixos-unstable, I get the bash-language-server error.

MattSturgeon commented 2 weeks ago

On nixos-unstable, I get the bash-language-server error.

That's a separate issue (see #1699). Removing inputs.nixvim.follows lines will work-around that.

khaneliman commented 2 weeks ago

Getting this error too on my config all of a sudden. Dont need a complex config, looks like its reproducible by just setting anything in the settings attribute of server.

EDIT: Somehow related to a new nixpkgs bump even though I dont have nixvim following my nixpkgs input. I was able to flake lock update every input but nixpkgs. Soon as I bump my nixpkgs from 06/13 to 06/16 it throws this error about evaluation.

Rustaceanvim Normal Config ```lua { pkgs, ... }: { programs.nixvim = { # Needed for RustPlay extraPlugins = with pkgs.vimPlugins; [ webapi-vim ]; plugins = { rustaceanvim = { enable = true; settings = { dap = { autoloadConfigurations = true; }; server = { settings = { cargo = { buildScripts.enable = true; features = "all"; }; diagnostics = { enable = true; styleLints.enable = true; }; checkOnSave = true; check = { command = "clippy"; features = "all"; }; files = { excludeDirs = [ ".cargo" ".direnv" ".git" "node_modules" "target" ]; }; inlayHints = { bindingModeHints.enable = true; closureStyle = "rust_analyzer"; closureReturnTypeHints.enable = "always"; discriminantHints.enable = "always"; expressionAdjustmentHints.enable = "always"; implicitDrops.enable = true; lifetimeElisionHints.enable = "always"; rangeExclusiveHints.enable = true; }; procMacro = { enable = true; }; rustc.source = "discover"; }; }; }; }; }; }; } ```
s1341 commented 2 weeks ago

I'm also getting this.. is there a fix or a workaround?

ngn999 commented 2 weeks ago

I'm also getting this.. is there a fix or a workaround?

Same error here. Comment nixvim.inputs.nixpkgs.follows , then nix flake lock works for me.

pta2002 commented 2 weeks ago

Getting this even with rust-analyzer disabled.

GaetanLepage commented 2 weeks ago

A quick fix will be shipped in #1719

GaetanLepage commented 2 weeks ago

Fixed (kind of) in #1719.

I will leave this issue open because we need to actually fix it for real.

ZainKergaye commented 2 weeks ago

Got the same error, thanks for giving out a solution. @pta2002 Have you updated your system fully? I'm still new and don't know all the key terms but at first that happened but a nix flake update and rebuild put me at the latest nixvim release

dezren39 commented 2 days ago

i no longer am experiencing this error

MattSturgeon commented 2 days ago

I no longer am experiencing this error

As mentioned above https://github.com/nix-community/nixvim/issues/1702#issuecomment-2175698064, we have a temporary workaround in place. @traxys is looking into the actual issue, so hopefully it'll be fixed properly soon.