cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.49k stars 339 forks source link

Are language servers in-scope? #1559

Open losnappas opened 4 weeks ago

losnappas commented 4 weeks ago

languages.python doesn't install pyright (or any other python lsp), but e.g. languages.clojure installs clojure-lsp. I'm wondering why that is.

domenkozar commented 4 weeks ago

Yes!

losnappas commented 4 weeks ago

Alright. Well, it seems for python the preferred method of installing an lsp is via pip with virtualenv. E.g. pip install 'python-lsp-server[all]', which may explain why it's not in the devenv setup.

That said, that installs mypy lang server, not pyright, and I'm wondering whether installing these via nix is fine anyway, considering it should match the python version from nixpkgs (in theory). I'll do some testing going fwd

losnappas commented 1 week ago

The problem is that pylsp is in pkgs.python312Packages.python-lsp-server, with the pythonXXXPackages, so if python.package is changed then I don't know how to refer to the correct lsp package.

sandydoo commented 1 week ago

The problem is that pylsp is in pkgs.python312Packages.python-lsp-server, with the pythonXXXPackages, so if python.package is changed then I don't know how to refer to the correct lsp package.

Each python package exposes a set of pkgs for that version.

{ config, pkgs, ... }:

{
  languages.python.enable = true;
  languages.python.package = pkgs.python312;

  packages = [
    config.languages.python.package.pkgs.python-lsp-server
  ];
}