From fde35735f552ab6ace339c9c86622958df2bcc9b Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 9 Jul 2023 12:33:13 +0200 Subject: [PATCH] vimPlugins.chadtree: add python dependencies --- .../editors/vim/plugins/overrides.nix | 11 +++++ .../patches/chadtree/emulate-venv.patch | 41 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 pkgs/applications/editors/vim/plugins/patches/chadtree/emulate-venv.patch diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index bc4fe327ce8a..45373a8abddd 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -149,6 +149,17 @@ self: super: { }; }; + chadtree = super.chadtree.overrideAttrs { + passthru.python3Dependencies = ps: with ps; [ + pynvim-pp + pyyaml + std2 + ]; + + # We need some patches so it stops complaining about not being in a venv + patches = [ ./patches/chadtree/emulate-venv.patch ]; + }; + ChatGPT-nvim = super.ChatGPT-nvim.overrideAttrs { dependencies = with self; [ nui-nvim plenary-nvim telescope-nvim ]; }; diff --git a/pkgs/applications/editors/vim/plugins/patches/chadtree/emulate-venv.patch b/pkgs/applications/editors/vim/plugins/patches/chadtree/emulate-venv.patch new file mode 100644 index 000000000000..4d3a7ad70df0 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/patches/chadtree/emulate-venv.patch @@ -0,0 +1,41 @@ +diff --git a/chadtree/__main__.py b/chadtree/__main__.py +index 83341fc..af8c9b0 100644 +--- a/chadtree/__main__.py ++++ b/chadtree/__main__.py +@@ -73,7 +73,7 @@ _EXEC_PATH = Path(executable) + _EXEC_PATH = _EXEC_PATH.parent.resolve(strict=True) / _EXEC_PATH.name + _REQ = REQUIREMENTS.read_text() + +-_IN_VENV = _RT_PY == _EXEC_PATH ++_IN_VENV = True + + + if command == "deps": +@@ -129,7 +129,7 @@ elif command == "run": + try: + if not _IN_VENV: + raise ImportError() +- elif lock != _REQ: ++ elif False: + raise ImportError() + else: + import pynvim_pp +diff --git a/chadtree/consts.py b/chadtree/consts.py +index e2d3aa0..e77a129 100644 +--- a/chadtree/consts.py ++++ b/chadtree/consts.py +@@ -1,4 +1,5 @@ + from os import environ, name ++from pathlib import Path + + from chad_types import TOP_LEVEL + +@@ -24,7 +25,7 @@ SETTINGS_VAR = "chadtree_settings" + STORAGE + """ + +-_VARS = TOP_LEVEL / ".vars" ++_VARS = Path.home() / ".cache/chadtree/vars" + RT_DIR = _VARS / "runtime" + RT_PY = RT_DIR / "Scripts" / "python.exe" if IS_WIN else RT_DIR / "bin" / "python3" + SESSION_DIR = _VARS / "sessions"