From b75e7c94f5e5763b6c70b3f356fe1dbd1ec009c0 Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Wed, 15 Jan 2025 11:57:09 +0100 Subject: [PATCH 1/3] feat(languages): Add Python --- nix/neovim-overlay.nix | 10 ++++++++-- nvim/ftplugin/python.lua | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 nvim/ftplugin/python.lua diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 3e96063..9399e65 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -128,10 +128,16 @@ with final.pkgs.lib; let asm-lsp # Assembly language server clang-tools # C/C++ language server (callPackage ./cpptools.nix {}) # C/C++ debugger from VSCode | https://github.com/microsoft/vscode-cpptools + nil # nix LSP nodePackages.bash-language-server # Bash language server lua-language-server - nil # nix LSP - ]; + ] ++ [ (pkgs.python312.withPackages (python-pkgs: [ + python-pkgs.python-lsp-server + python-pkgs.python-lsp-ruff + python-pkgs.pylsp-mypy + python-pkgs.pylsp-rope + ]))]; + in { # This is the neovim derivation # returned by the overlay diff --git a/nvim/ftplugin/python.lua b/nvim/ftplugin/python.lua new file mode 100644 index 0000000..5d04524 --- /dev/null +++ b/nvim/ftplugin/python.lua @@ -0,0 +1,36 @@ +-- Exit if the language server isn't available +if vim.fn.executable('pylsp') ~= 1 then + return +end + +local root_files = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + 'pyrightconfig.json', + '.git', +} + +vim.lsp.start({ + name = 'python-lsp-server', + cmd = { "pylsp" }, + root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]), + capabilities = require('user.lsp').make_client_capabilities(), + filetypes = { 'python' }, + on_attach = function(client, bufnr) + require("nvim-navic").attach(client, bufnr) + require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr) + end, + settings = { + pylsp = { + plugins = { + mypy = { enabled = true, }, + rope = { enabled = true, }, + ruff = { enabled = true, }, + }, + }, + }, + single_file_support = true +}) From ea68d8de0b005ca1db1d2770c7cf99f35b5e2d35 Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Thu, 16 Jan 2025 09:17:59 +0100 Subject: [PATCH 2/3] fix: Formatting --- nix/neovim-overlay.nix | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 9399e65..2e3f2fb 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -120,24 +120,27 @@ with final.pkgs.lib; let # ^ bleeding-edge plugins from flake inputs ]; - extraPackages = with pkgs; [ - # Dependencies - ripgrep - - # language servers, etc. - asm-lsp # Assembly language server - clang-tools # C/C++ language server - (callPackage ./cpptools.nix {}) # C/C++ debugger from VSCode | https://github.com/microsoft/vscode-cpptools - nil # nix LSP - nodePackages.bash-language-server # Bash language server - lua-language-server - ] ++ [ (pkgs.python312.withPackages (python-pkgs: [ - python-pkgs.python-lsp-server - python-pkgs.python-lsp-ruff - python-pkgs.pylsp-mypy - python-pkgs.pylsp-rope - ]))]; + extraPackages = with pkgs; + [ + # Dependencies + ripgrep + # language servers, etc. + asm-lsp # Assembly language server + clang-tools # C/C++ language server + (callPackage ./cpptools.nix {}) # C/C++ debugger from VSCode | https://github.com/microsoft/vscode-cpptools + nil # nix LSP + nodePackages.bash-language-server # Bash language server + lua-language-server + ] + ++ [ + (pkgs.python312.withPackages (python-pkgs: [ + python-pkgs.python-lsp-server + python-pkgs.python-lsp-ruff + python-pkgs.pylsp-mypy + python-pkgs.pylsp-rope + ])) + ]; in { # This is the neovim derivation # returned by the overlay From 3ea29b1f8bd2d5e731ff05b5c5eef21ea01a3494 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 18 Jan 2025 00:01:07 +0000 Subject: [PATCH 3/3] automated: Update `flake.lock` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The following Nix Flake inputs were updated: ``` • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/bffc22eb12172e6db3c5dde9e3e5628f8e3e7912?narHash=sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc%2Bc2c%3D' (2025-01-08) → 'github:NixOS/nixpkgs/5df43628fdf08d642be8ba5b3625a6c70731c19c?narHash=sha256-Tbk1MZbtV2s5aG%2BiM99U8FqwxU/YNArMcWAv6clcsBc%3D' (2025-01-16) ``` Auto-generated by [update.yml][1] with the help of [create-pull-request][2]. [1]: https://forgejo.stefka.eu/jiriks74/nix.nvim/src/branch/main/.github/workflows/update.yml [2]: https://forgejo.stefka.eu/jiriks74/create-pull-request --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 26581a9..32cef8d 100644 --- a/flake.lock +++ b/flake.lock @@ -181,11 +181,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1736344531, - "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", + "lastModified": 1737062831, + "narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", + "rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c", "type": "github" }, "original": {