parent
8807ca3cad
commit
8cd000fb6b
6 changed files with 42 additions and 56 deletions
|
@ -55,7 +55,6 @@
|
|||
enableGolang = false;
|
||||
enableJava = false;
|
||||
enableNix = false;
|
||||
enablePython = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ in
|
|||
"kotlin"
|
||||
"lua"
|
||||
"markdown"
|
||||
"python"
|
||||
"qml"
|
||||
"rust"
|
||||
"web"
|
||||
|
|
6
flake.lock
generated
6
flake.lock
generated
|
@ -863,11 +863,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1748609540,
|
||||
"narHash": "sha256-fJXILZ07bFCW3pH6mVoKXr+LkZSMB2PSXObcQtDkWBg=",
|
||||
"lastModified": 1748748278,
|
||||
"narHash": "sha256-2lR5nVfPpxTta8H4F9bJaeZFZnG2AcrL/N14+Htv8l0=",
|
||||
"owner": "matt1432",
|
||||
"repo": "Kapowarr",
|
||||
"rev": "aebda36b96c46bd5333f0d14e560557338eb226c",
|
||||
"rev": "32c03c36afa87c3d1fddd99a5ada36d9a7bfaf10",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -37,10 +37,6 @@ in {
|
|||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
enablePython = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,68 +1,46 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) attrValues mkIf;
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
|
||||
# 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;
|
||||
flakeEnv = config.programs.bash.sessionVariables.FLAKE;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.ideConfig.enablePython) {
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
neovim = {
|
||||
withPython3 = true;
|
||||
|
||||
extraPython3Packages = pythonPkgs;
|
||||
extraPackages = pythonPkgs pkgs.python3Packages;
|
||||
|
||||
extraLuaConfig =
|
||||
# lua
|
||||
''
|
||||
require('lspconfig').pylsp.setup({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
local lsp = require('lspconfig');
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
-- auto-completion options
|
||||
jedi_completion = {
|
||||
fuzzy = true,
|
||||
},
|
||||
lsp.basedpyright.setup({
|
||||
capabilities = default_capabilities,
|
||||
autostart = false,
|
||||
});
|
||||
|
||||
-- import sorting
|
||||
pyls_isort = {
|
||||
enabled = true,
|
||||
},
|
||||
lsp.ruff.setup({
|
||||
capabilities = default_capabilities,
|
||||
autostart = false,
|
||||
});
|
||||
|
||||
-- type checker
|
||||
pylsp_mypy = {
|
||||
enabled = true,
|
||||
},
|
||||
vim.api.nvim_create_autocmd({ 'FileType', 'BufEnter' }, {
|
||||
pattern = { 'python' },
|
||||
|
||||
-- linter
|
||||
ruff = {
|
||||
enabled = true,
|
||||
formatEnabled = true,
|
||||
lineLength = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
callback = function()
|
||||
vim.cmd[[setlocal ts=4 sw=4 sts=0 expandtab]];
|
||||
|
||||
if (devShells['python'] == nil) then
|
||||
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