about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-03 16:15:59 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2023-02-03 16:15:59 +0100
commit4451964f1a881cc85ec60547fd6b74d906df3a34 (patch)
tree41d8b72421f5f4711ac84125e21cb844ac219bb8
parentDotfiles: Emacs: C/C++ support (diff)
downloadnixos-config-emacs_lsp.tar.gz
nixos-config-emacs_lsp.tar.bz2
nixos-config-emacs_lsp.zip
In progress emacs_lsp
-rw-r--r--hosts/home.nix4
-rw-r--r--overlays/base/default.nix6
-rw-r--r--packages/emacs.nix6
-rw-r--r--packages/lsp-bridge/default.nix64
4 files changed, 77 insertions, 3 deletions
diff --git a/hosts/home.nix b/hosts/home.nix
index 8c24b56..844f28e 100644
--- a/hosts/home.nix
+++ b/hosts/home.nix
@@ -158,11 +158,9 @@
         doom-modeline
         dashboard
 
-        lsp-ui
         projectile
 
-        lsp-mode
-        company
+        custom.lsp-bridge
         rust-mode
         rustic
         flycheck
diff --git a/overlays/base/default.nix b/overlays/base/default.nix
index 2f021c7..b1ae99a 100644
--- a/overlays/base/default.nix
+++ b/overlays/base/default.nix
@@ -81,4 +81,10 @@ final: prev:
     scripts = [ prev.mpvScripts.mpris ];
   };
 
+  emacsPackagesFor = let merge = builtins.foldl' (a: b: a // b) {}; in
+  	emacs: with prev; (((prev.emacsPackagesFor emacs) // merge [
+	  (import ../../packages/lsp-bridge {})
+	]) {});
+
+
 }
diff --git a/packages/emacs.nix b/packages/emacs.nix
new file mode 100644
index 0000000..97cb4f6
--- /dev/null
+++ b/packages/emacs.nix
@@ -0,0 +1,6 @@
+final: prev:
+{
+  custom = {
+    lsp-bridge = prev.callPackage ./lsp-bridge { };
+  };
+}
diff --git a/packages/lsp-bridge/default.nix b/packages/lsp-bridge/default.nix
new file mode 100644
index 0000000..7eba8f0
--- /dev/null
+++ b/packages/lsp-bridge/default.nix
@@ -0,0 +1,64 @@
+{ lib
+, trivialBuild
+, fetchFromGitHub
+, python3Packages
+, python3
+, posframe
+, markdown-mode
+, yasnippet
+, org
+, which-key
+, makeWrapper
+}:
+
+let
+  rev = "7dfeeb640d14697755e2ac7997af0ec6c413197f";
+  python = python3.withPackages (ps: with ps; [ epc orjson sexpdata six ]);
+in trivialBuild {
+  pname = "lsp-bridge";
+  version = "20230104";
+
+  commit = rev;
+
+  src = fetchFromGitHub {
+    owner = "manateelazycat";
+    repo = "lsp-bridge";
+    inherit rev;
+    sha256 = "sha256-sB5niigN0rdtqeprlZAJEKgAuQDkcUMbbL9yTnrdoLg=";
+  };
+
+  packageRequires =
+    [
+      posframe
+      markdown-mode
+      yasnippet
+      org
+      which-key
+    ];
+
+  buildPhase = ''
+    runHook preInstall
+    install -d $out/share/emacs/site-lisp/
+    install *.el $out/share/emacs/site-lisp/
+    install acm/*.el $out/share/emacs/site-lisp/
+    install *.py $out/share/emacs/site-lisp/
+    cp -r core $out/share/emacs/site-lisp/
+    cp -r langserver $out/share/emacs/site-lisp/
+    cp -r multiserver $out/share/emacs/site-lisp/
+    cp -r resources $out/share/emacs/site-lisp/
+    cp -r acm/icons $out/share/emacs/site-lisp/
+    runHook postInstall
+  '';
+
+  postPatch = ''
+    substituteInPlace lsp-bridge.el --replace '(defcustom lsp-bridge-python-command (if (memq system-type '"'"'(cygwin windows-nt ms-dos)) "python.exe" "python3")' '(defcustom lsp-bridge-python-command "${python.interpreter}"'
+  '';
+
+  meta = {
+    description = "Fastest LSP client in Emacs.";
+    longDescription = ''
+        Using python's threading technology to build caches that bridge Emacs and LSP server.
+      '';
+    license = lib.licenses.gpl3;
+  };
+}