diff --git a/modules/output.nix b/modules/output.nix index fbc115c3ed..f32371cf9b 100644 --- a/modules/output.nix +++ b/modules/output.nix @@ -38,6 +38,24 @@ in { description = "Extra packages to be made available to neovim"; }; + python = { + package = mkOption { + type = types.package; + default = pkgs.python3; + description = ""; + }; + + extraPythonPackages = mkOption { + type = with types; functionTo (listOf package); + default = p: with p; []; + defaultText = literalExpression "p: with p; [ ]"; + description = "Python packages to add to the `PYTHONPATH` of neovim."; + example = lib.literalExpression '' + p: [ p.numpy ] + ''; + }; + }; + extraConfigLua = mkOption { type = types.lines; default = ""; diff --git a/wrappers/modules/output.nix b/wrappers/modules/output.nix index 4f346c89d5..c306feffeb 100644 --- a/wrappers/modules/output.nix +++ b/wrappers/modules/output.nix @@ -103,6 +103,13 @@ in { inherit (config) viAlias vimAlias; # inherit customRC; plugins = normalizedPlugins; + + # Python 3 environment + python3Env = let + python = config.python.package; + inherit (config.python) extraPythonPackages; + in + python.withPackages extraPythonPackages; } # Necessary to make sure the runtime path is set properly in NixOS 22.05, # or more generally before the commit: