Skip to content

Commit

Permalink
misc: fix python environment options
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Jan 6, 2024
1 parent a1f8b43 commit d52f656
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 31 deletions.
24 changes: 8 additions & 16 deletions modules/output.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,14 @@ 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: [];
defaultText = literalExpression "p: with p; [ ]";
description = "Python packages to add to the `PYTHONPATH` of neovim.";
example = lib.literalExpression ''
p: [ p.numpy ]
'';
};
extraPythonPackages = mkOption {
type = with types; functionTo (listOf package);
default = p: [];
defaultText = literalExpression "p: with p; [ ]";
description = "Python packages to add to the `PYTHONPATH` of neovim.";
example = lib.literalExpression ''
p: [ p.numpy ]
'';
};

extraConfigLua = mkOption {
Expand Down
11 changes: 4 additions & 7 deletions tests/test-sources/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
plain = {};

python-packages = {
python = {
package = pkgs.python3;
extraPythonPackages = p:
with p; [
numpy
];
};
extraPythonPackages = p:
with p; [
numpy
];
};

simple-plugin = {
Expand Down
14 changes: 6 additions & 8 deletions wrappers/modules/output.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,14 @@ in {
config.extraPlugins;

neovimConfig = pkgs.neovimUtils.makeNeovimConfig ({
inherit (config) viAlias vimAlias;
inherit
(config)
extraPythonPackages
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:
Expand Down

0 comments on commit d52f656

Please sign in to comment.