mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-27 19:18:57 +02:00
plugins/lsp/pylsp: Add python option to generate obtain the pylsp from.
Currently, pkgs.python3Packges is used by default and is unable to be changed. This stops consumers from using different/newer python versions.
This commit is contained in:
parent
100ae4027d
commit
079c2c479b
1 changed files with 479 additions and 472 deletions
|
@ -10,10 +10,16 @@ let
|
||||||
cfg = config.plugins.lsp.servers.pylsp;
|
cfg = config.plugins.lsp.servers.pylsp;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
options.plugins.lsp.servers.pylsp = {
|
||||||
|
pythonPackage = mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
description = "Python package to use for lsp.";
|
||||||
|
default = pkgs.python3;
|
||||||
|
};
|
||||||
|
|
||||||
# All settings are documented here:
|
# All settings are documented here:
|
||||||
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
|
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
|
||||||
|
settings = {
|
||||||
options.plugins.lsp.servers.pylsp.settings = {
|
|
||||||
configurationSources = mkOption {
|
configurationSources = mkOption {
|
||||||
type = lib.types.nullOr (
|
type = lib.types.nullOr (
|
||||||
types.enum [
|
types.enum [
|
||||||
|
@ -491,6 +497,7 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# WARNING: tricky stuff below:
|
# WARNING: tricky stuff below:
|
||||||
|
@ -540,7 +547,7 @@ in
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
with pkgs.python3Packages;
|
with cfg.pythonPackage.pkgs;
|
||||||
{
|
{
|
||||||
pylsp_mypy = pylsp-mypy.overridePythonAttrs (old: {
|
pylsp_mypy = pylsp-mypy.overridePythonAttrs (old: {
|
||||||
postPatch =
|
postPatch =
|
||||||
|
@ -598,7 +605,7 @@ in
|
||||||
in
|
in
|
||||||
mkDefault (
|
mkDefault (
|
||||||
# This is the final default package for pylsp
|
# This is the final default package for pylsp
|
||||||
pkgs.python3Packages.python-lsp-server.overridePythonAttrs (old: {
|
cfg.pythonPackage.pkgs.python-lsp-server.overridePythonAttrs (old: {
|
||||||
propagatedBuildInputs = pylspPlugins ++ old.dependencies;
|
propagatedBuildInputs = pylspPlugins ++ old.dependencies;
|
||||||
disabledTests = (old.disabledTests or [ ]) ++ [
|
disabledTests = (old.disabledTests or [ ]) ++ [
|
||||||
# Those tests fail when third-party plugins are loaded
|
# Those tests fail when third-party plugins are loaded
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue