nix-community.nixvim/plugins/by-name/whichpy/default.nix
osbm a41559f093
Some checks are pending
Publish every Git push to main to FlakeHub / flakehub-publish (push) Waiting to run
Publish every git push to Flakestry / publish-flake (push) Waiting to run
Documentation / Version info (push) Waiting to run
Documentation / Build (push) Blocked by required conditions
Documentation / Combine builds (push) Blocked by required conditions
Documentation / Deploy (push) Blocked by required conditions
treewide: add plugin descriptions
2025-06-24 06:10:11 +00:00

57 lines
1.5 KiB
Nix

{
lib,
config,
...
}:
lib.nixvim.plugins.mkNeovimPlugin {
name = "whichpy";
packPathName = "whichpy.nvim";
package = "whichpy-nvim";
description = "Python interpreter selector for Neovim. Switch interpreters without restarting LSP.";
maintainers = [ lib.maintainers.wvffle ];
settingsExample = {
update_path_env = true;
locator = {
workspace.depth = 3;
uv.enable = true;
};
};
extraOptions = {
neotestIntegration = lib.mkEnableOption "neotest-integration for whichpy-nvim.";
};
extraConfig = cfg: {
plugins.neotest.adapters.python.settings = lib.mkIf cfg.neotestIntegration {
python = lib.nixvim.mkRaw ''
function()
local whichpy_python = require("whichpy.envs").current_selected()
if whichpy_python then
return whichpy_python
end
return require("neotest-python.base").get_python_command
end
'';
};
warnings = lib.nixvim.mkWarnings "plugins.whichpy" [
{
when = cfg.neotestIntegration && !config.plugins.neotest.enable;
message = ''
You have enabled the neotest integration with whichpy but `plugins.neotest` is not enabled.
'';
}
{
when =
cfg.neotestIntegration
&& config.plugins.neotest.enable
&& !config.plugins.neotest.adapters.python.enable;
message = ''
You have enabled the neotest integration with whichpy but `plugins.neotest.adapters.python` is not enabled.
'';
}
];
};
}