nix-community / nixvim

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

[BUG] `error: attribute 'propagatedBuildInputs' missing` in pylsp support #1894

Closed vsiles closed 1 month ago

vsiles commented 1 month ago
Field Description
Plugin lsp
Nixpkgs github:nixos/nixpkgs/af9c15bc7a314c226d7d5d85e159f7a73e8d9fae
Home Manager github:nix-community/home-manager/afd2021bedff2de92dfce0e257a3d03ae65c603d

Description

After updating my setup with nix flake update, I get the following error on nix flake check or home-manager switch:

error:
       … while checking flake output 'checks'
         at /nix/store/hrcpxll4nfdvzn3a80n1shrddkj10y69-source/flake.nix:187:7:
          186|       # for every architecture. Here, our derivation is mac-dependent, so it doesn't really matter.
          187|       checks.aarch64-darwin = { canBuild = mac.system; };
             |       ^
          188|       checks.x86_64-linux = { canBuild = linux.activationPackage; };

       … while checking the derivation 'checks.aarch64-darwin.canBuild'
         at /nix/store/hrcpxll4nfdvzn3a80n1shrddkj10y69-source/flake.nix:187:33:
          186|       # for every architecture. Here, our derivation is mac-dependent, so it doesn't really matter.
          187|       checks.aarch64-darwin = { canBuild = mac.system; };
             |                                 ^
          188|       checks.x86_64-linux = { canBuild = linux.activationPackage; };

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

       error: attribute 'propagatedBuildInputs' missing
       at /nix/store/ak4s54jqdq5yhpsc2l7xahr06b4ib0qn-source/plugins/lsp/language-servers/pylsp.nix:542:90:
          541|                   # Get rid of the python-lsp-server dependency
          542|                   propagatedBuildInputs = filter (dep: dep.pname != "python-lsp-server") old.propagatedBuildInputs;
             |                                                                                          ^
          543|

No change to my local nix files has been done (here is my plugin config: https://github.com/vsiles/config/blob/master/home-manager/lsp.nix#L45)

Minimal, Reproducible Example (MRE)

programs.nixvim = {
  plugins = {
    lsp = {
      servers = {
                    pylsp = {
                        enable = true;
                        settings = {
                            configurationSources = "flake8";
                            plugins = {
                                pycodestyle.enabled = false;
                                mccabe.enabled = false;
                                pyflakes.enabled = false;
                                mypy.enabled = true;
                                black = {
                                    enabled = true;
                                    lineLength = 120;
                                };
                                isort.enabled = true;
                                flake8 = {
                                    enabled = true;
                                    maxLineLength = 120;
                                };
                            };
                        };
                    };
    };
  };
}
MattSturgeon commented 1 month ago

For now, try removing any "follows" lines affecting nixvim in your flake inputs and re-run nix flake lock.

See https://github.com/nix-community/nixvim/pull/1893#issuecomment-2239084122

vsiles commented 1 month ago

I'll get a look, thanks !

charludo commented 1 month ago

For now, try removing any "follows" lines affecting nixvim in your flake inputs and re-run nix flake lock.

See #1893 (comment)

No luck, unfortunately. (Not OP, but same error)

charludo commented 1 month ago

For now, try removing any "follows" lines affecting nixvim in your flake inputs and re-run nix flake lock. See #1893 (comment)

No luck, unfortunately. (Not OP, but same error)

Edit: disabling ruff solves the issue (programs.nixvim.plugins.lsp.servers.pylsp.settings.plugins.ruff.enabled = false;). That's an OK workaround for me for now.

I am a bit confused though because this doesn't appear to have anything to do with pylsp-rope mentioned in #1893, unless I am mistaken?

vsiles commented 1 month ago

For now, try removing any "follows" lines affecting nixvim in your flake inputs and re-run nix flake lock. See #1893 (comment)

No luck, unfortunately. (Not OP, but same error)

Edit: disabling ruff solves the issue (programs.nixvim.plugins.lsp.servers.pylsp.settings.plugins.ruff.enabled = false;). That's an OK workaround for me for now.

I am a bit confused though because this doesn't appear to have anything to do with pylsp-rope mentioned in #1893, unless I am mistaken?

Can you share your config ? I tried disabling ruff and it didn't fix it for me. I'll try to do the follows fix too.

charludo commented 1 month ago

For now, try removing any "follows" lines affecting nixvim in your flake inputs and re-run nix flake lock. See #1893 (comment)

No luck, unfortunately. (Not OP, but same error)

Edit: disabling ruff solves the issue (programs.nixvim.plugins.lsp.servers.pylsp.settings.plugins.ruff.enabled = false;). That's an OK workaround for me for now. I am a bit confused though because this doesn't appear to have anything to do with pylsp-rope mentioned in #1893, unless I am mistaken?

Can you share your config ? I tried disabling ruff and it didn't fix it for me. I'll try to do the follows fix too.

This is everything relating to python that I have:

{ pkgs, ... }:
{
  programs.nixvim.plugins.lsp.servers.pylsp = {
    enable = true;
    filetypes = [ "python" ];
    settings.plugins = {
      black.enabled = true;
      black.line_length = 88;

      isort.enabled = true;
      pylint.enabled = true;

      pycodestyle.enabled = true;
      pycodestyle.maxLineLength = 88;
      pycodestyle.ignore = [ "E501" "W503" "R0903" ];

      # pylsp_mypy.enabled = true;
      # pylsp_mypy.dmypy = true;

      ruff.enabled = false;
      ruff.lineLength = 88;
    };
  };
  programs.nixvim.plugins.lint.lintersByFt.python = [ "pylint" ];
  programs.nixvim.extraPackages = [ pkgs.pylint pkgs.ruff ];
  home.shellAliases.ruff = "${pkgs.ruff}/bin/ruff";
}

I kept my follows ... though.

vsiles commented 1 month ago

~~Looks like adding the follows workaround and the ruff disable works for me ! Hopefully this will be fixed upstream :D Thank you !~~ I spoke too soon. Still the same error.

MattSturgeon commented 1 month ago

If you have a newer nixpkgs lock than us then any number of python packages may affect you, since we have yet to update our implementation to match the very latest nixpkgs.

It's also possible for nixpkgs differences to affect you even if the relevant options are not enabled, because the modules still get evaluated.


If disabling follows doesn't help then it's possible we're already locked to an affected nixpkgs rev (but that doesn't make sence, since our test suite should've noticed)...

traxys commented 1 month ago

follows don't affect the home-manager & nixos moddules, it only affects the standalone configuration

MattSturgeon commented 1 month ago

follows don't affect the home-manager & nixos moddules, it only affects the standalone configuration

Ah yes, you're right. https://github.com/nix-community/nixvim/issues/1784 could eventually allow a solution to that; we could have something similar to home-manager's useGlobalPkgs option.

PerchunPak commented 1 month ago

This should be fixed by https://github.com/nix-community/nixvim/commit/9f9e20205a5631474120f2a2cd10d4ff32a6abed