From 844c7a98765d93135dc1f15bf4b0ed5786f0934b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 27 Oct 2023 19:31:03 +0200 Subject: [PATCH] feat(nvim): add neotest plugin --- flake.lock | 35 ++++++++++--------- flake.nix | 2 ++ modules/programs/nvim/plugins/coding.nix | 20 +++++++++++ modules/programs/nvim/plugins/lua/neotest.lua | 7 ++++ overlays/vimPlugins.nix | 7 +++- 5 files changed, 53 insertions(+), 18 deletions(-) create mode 100644 modules/programs/nvim/plugins/lua/neotest.lua diff --git a/flake.lock b/flake.lock index bcfc87f..57bc135 100644 --- a/flake.lock +++ b/flake.lock @@ -621,6 +621,23 @@ "type": "github" } }, + "neotest-python": { + "flake": false, + "locked": { + "lastModified": 1698425037, + "narHash": "sha256-C3Dw+fl1QNYU9tg0fE52EzOqeGXxu1vq5SPmDnv2LD8=", + "owner": "MoritzBoehme", + "repo": "neotest-python", + "rev": "3c09dbafb0a1e3ac8b19eabc7157ec312cc2f2ee", + "type": "github" + }, + "original": { + "owner": "MoritzBoehme", + "ref": "fix-runtimepath-search", + "repo": "neotest-python", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils_2", @@ -1091,6 +1108,7 @@ "hyprpaper": "hyprpaper", "impermanence": "impermanence", "master": "master", + "neotest-python": "neotest-python", "neovim-nightly-overlay": "neovim-nightly-overlay", "nix-index-database": "nix-index-database", "nix-lazy-nvim": "nix-lazy-nvim", @@ -1106,7 +1124,6 @@ "smartcolumn-nvim": "smartcolumn-nvim", "stable": "stable", "telekasten-nvim": "telekasten-nvim", - "telescope-nvim": "telescope-nvim", "timers": "timers" } }, @@ -1248,22 +1265,6 @@ "type": "github" } }, - "telescope-nvim": { - "flake": false, - "locked": { - "lastModified": 1696709104, - "narHash": "sha256-v68sId4cWHneUaaYp2neVtBobNZo8lsxKoBhRF4yZrI=", - "owner": "nvim-telescope", - "repo": "telescope.nvim", - "rev": "5a747a9587e4bfc4ae086a38cc679fe54f983b69", - "type": "github" - }, - "original": { - "owner": "nvim-telescope", - "repo": "telescope.nvim", - "type": "github" - } - }, "timers": { "inputs": { "naersk": "naersk", diff --git a/flake.nix b/flake.nix index a4e0f0a..d21f71f 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,8 @@ telekasten-nvim.url = "github:renerocksai/telekasten.nvim"; none-ls-nvim.flake = false; none-ls-nvim.url = "github:nvimtools/none-ls.nvim"; + neotest-python.flake = false; + neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search"; # Hyprland hypr-contrib.url = "github:hyprwm/contrib"; diff --git a/modules/programs/nvim/plugins/coding.nix b/modules/programs/nvim/plugins/coding.nix index 955be6f..5c5a168 100644 --- a/modules/programs/nvim/plugins/coding.nix +++ b/modules/programs/nvim/plugins/coding.nix @@ -306,5 +306,25 @@ with builtins; plugin = nvim-puppeteer; lazy = false; # NOTE: plugin lazy-loads itself. } + { + plugin = neotest; + lazy = false; + keys = [ + { key = "ct"; cmd = "lua require('neotest').summary.toggle()"; desc = "Test"; } + ]; + dependencies = [ + { plugin = plenary-nvim; } + { plugin = FixCursorHold-nvim; } + + # adapters + { + plugin = neotest-python; + conf = /* lua */ '' + vim.opt.runtimepath:append("${neotest-python}") + ''; + } + ]; + conf = readFile ./lua/neotest.lua; + } ]; } diff --git a/modules/programs/nvim/plugins/lua/neotest.lua b/modules/programs/nvim/plugins/lua/neotest.lua new file mode 100644 index 0000000..4df1b8c --- /dev/null +++ b/modules/programs/nvim/plugins/lua/neotest.lua @@ -0,0 +1,7 @@ +require("neotest").setup({ + adapters = { + require("neotest-python")({ + dap = { justMyCode = false }, + }), + }, +}) diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index 8b340d4..f76f56c 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -47,9 +47,14 @@ with lib.my; src = inputs.nvim-puppeteer; }; - null-ls-nvim = prev.vimPlugins.null-ls-nvim.overrideAttrs (a: { + null-ls-nvim = prev.vimPlugins.null-ls-nvim.overrideAttrs (_: { version = mkVersionInput inputs.none-ls-nvim; src = inputs.none-ls-nvim; }); + + neotest-python = prev.vimPlugins.neotest-python.overrideAttrs (_: { + version = mkVersionInput inputs.neotest-python; + src = inputs.neotest-python; + }); }; }