parent
8807ca3cad
commit
8cd000fb6b
6 changed files with 42 additions and 56 deletions
|
@ -55,7 +55,6 @@
|
||||||
enableGolang = false;
|
enableGolang = false;
|
||||||
enableJava = false;
|
enableJava = false;
|
||||||
enableNix = false;
|
enableNix = false;
|
||||||
enablePython = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ in
|
||||||
"kotlin"
|
"kotlin"
|
||||||
"lua"
|
"lua"
|
||||||
"markdown"
|
"markdown"
|
||||||
|
"python"
|
||||||
"qml"
|
"qml"
|
||||||
"rust"
|
"rust"
|
||||||
"web"
|
"web"
|
||||||
|
|
6
flake.lock
generated
6
flake.lock
generated
|
@ -863,11 +863,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748609540,
|
"lastModified": 1748748278,
|
||||||
"narHash": "sha256-fJXILZ07bFCW3pH6mVoKXr+LkZSMB2PSXObcQtDkWBg=",
|
"narHash": "sha256-2lR5nVfPpxTta8H4F9bJaeZFZnG2AcrL/N14+Htv8l0=",
|
||||||
"owner": "matt1432",
|
"owner": "matt1432",
|
||||||
"repo": "Kapowarr",
|
"repo": "Kapowarr",
|
||||||
"rev": "aebda36b96c46bd5333f0d14e560557338eb226c",
|
"rev": "32c03c36afa87c3d1fddd99a5ada36d9a7bfaf10",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -37,10 +37,6 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
enablePython = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,68 +1,46 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) attrValues mkIf;
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
cfg = config.programs.neovim;
|
cfg = config.programs.neovim;
|
||||||
|
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
||||||
# We keep the packages here because python is a bit complicated and common
|
|
||||||
pythonPkgs = p:
|
|
||||||
(attrValues {
|
|
||||||
inherit
|
|
||||||
(p)
|
|
||||||
python-lsp-server
|
|
||||||
pyls-isort
|
|
||||||
pylsp-mypy
|
|
||||||
python-lsp-ruff
|
|
||||||
python-lsp-jsonrpc
|
|
||||||
;
|
|
||||||
})
|
|
||||||
++ p.python-lsp-server.optional-dependencies.all;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf (cfg.enable && cfg.ideConfig.enablePython) {
|
config = mkIf cfg.enable {
|
||||||
programs = {
|
programs = {
|
||||||
neovim = {
|
neovim = {
|
||||||
withPython3 = true;
|
|
||||||
|
|
||||||
extraPython3Packages = pythonPkgs;
|
|
||||||
extraPackages = pythonPkgs pkgs.python3Packages;
|
|
||||||
|
|
||||||
extraLuaConfig =
|
extraLuaConfig =
|
||||||
# lua
|
# lua
|
||||||
''
|
''
|
||||||
require('lspconfig').pylsp.setup({
|
local lsp = require('lspconfig');
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||||
|
|
||||||
settings = {
|
lsp.basedpyright.setup({
|
||||||
pylsp = {
|
capabilities = default_capabilities,
|
||||||
plugins = {
|
autostart = false,
|
||||||
-- auto-completion options
|
});
|
||||||
jedi_completion = {
|
|
||||||
fuzzy = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- import sorting
|
lsp.ruff.setup({
|
||||||
pyls_isort = {
|
capabilities = default_capabilities,
|
||||||
enabled = true,
|
autostart = false,
|
||||||
},
|
});
|
||||||
|
|
||||||
-- type checker
|
vim.api.nvim_create_autocmd({ 'FileType', 'BufEnter' }, {
|
||||||
pylsp_mypy = {
|
pattern = { 'python' },
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- linter
|
callback = function()
|
||||||
ruff = {
|
vim.cmd[[setlocal ts=4 sw=4 sts=0 expandtab]];
|
||||||
enabled = true,
|
|
||||||
formatEnabled = true,
|
if (devShells['python'] == nil) then
|
||||||
lineLength = 100,
|
devShells['python'] = 1;
|
||||||
},
|
|
||||||
},
|
require('nix-develop').nix_develop_extend({'${flakeEnv}#python'}, function()
|
||||||
},
|
vim.cmd[[LspStart]];
|
||||||
},
|
end);
|
||||||
|
end
|
||||||
|
end,
|
||||||
});
|
});
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
12
homeManagerModules/neovim/langs/python/shell.nix
Normal file
12
homeManagerModules/neovim/langs/python/shell.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
mkShell,
|
||||||
|
basedpyright,
|
||||||
|
ruff,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
mkShell {
|
||||||
|
packages = [
|
||||||
|
basedpyright
|
||||||
|
ruff
|
||||||
|
];
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue