nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

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

Open LudovicoPiero opened this issue 1 year ago • 12 comments

Field Description
Plugin lsp
Nixpkgs unstable
Home Manager unstable

  • [x] I have read the FAQ and my bug is not listed there.

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;
              };
            };
          };
        };
      };
    };
 };
}

LudovicoPiero avatar Jun 15 '24 15:06 LudovicoPiero

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.

MattSturgeon avatar Jun 15 '24 20:06 MattSturgeon

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

LudovicoPiero avatar Jun 15 '24 20:06 LudovicoPiero

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.

MattSturgeon avatar Jun 15 '24 20:06 MattSturgeon

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
{ 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";
            };
          };
        };
      };
    };
  };
}

khaneliman avatar Jun 18 '24 00:06 khaneliman

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

s1341 avatar Jun 18 '24 04:06 s1341

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.

ngn999 avatar Jun 18 '24 06:06 ngn999

Getting this even with rust-analyzer disabled.

pta2002 avatar Jun 18 '24 08:06 pta2002

A quick fix will be shipped in #1719

GaetanLepage avatar Jun 18 '24 09:06 GaetanLepage

Fixed (kind of) in #1719.

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

GaetanLepage avatar Jun 18 '24 09:06 GaetanLepage

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

ZainKergaye avatar Jun 21 '24 01:06 ZainKergaye

i no longer am experiencing this error

dezren39 avatar Jul 03 '24 03:07 dezren39

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.

MattSturgeon avatar Jul 03 '24 13:07 MattSturgeon

This is now fully fixed right ?

GaetanLepage avatar Jul 08 '24 07:07 GaetanLepage

Should be fixed by #1806

MattSturgeon avatar Jul 08 '24 07:07 MattSturgeon