From c397c143e107d1897c215d67b38e3d1c78385908 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Wed, 3 Jul 2024 19:43:15 +0200 Subject: [PATCH] Add ltex-ls to latex --- flake.lock | 12 ++++++------ home/kakoune/kak.nix | 22 ++++++++++++---------- overlay.nix | 13 +++++++++++++ 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index 83e5433..ff23d0e 100644 --- a/flake.lock +++ b/flake.lock @@ -761,11 +761,11 @@ "kak-lsp": { "flake": false, "locked": { - "lastModified": 1716147388, - "narHash": "sha256-v23rgAQZkIdCXZTyyvGL9GqMZNbiDHziQIdMNctNvKE=", + "lastModified": 1719761259, + "narHash": "sha256-2cnjweEU/NgQffF2gav9b6EIXmV9TcSd7214FzW7ekY=", "owner": "kakoune-lsp", "repo": "kakoune-lsp", - "rev": "384cc52ed75eaeed95503fa2f92f635968012847", + "rev": "484b19c2e373988ee5ab9afc54ecd6383b8da9bc", "type": "github" }, "original": { @@ -777,11 +777,11 @@ "kakoune": { "flake": false, "locked": { - "lastModified": 1716007386, - "narHash": "sha256-1nYSVbvQ4tz1r8p7zCD6w/79haqpelb15qva9r3Fwew=", + "lastModified": 1719405481, + "narHash": "sha256-IkPZSkEJQixpylRGqLO330oZ50CS0Aq0JqMvU5B+Abo=", "owner": "mawww", "repo": "kakoune", - "rev": "1bd50261c8c1c867f76e79f626dc571981f15bfd", + "rev": "80fcfebca8c62ace6cf2af9487784486af07d2d5", "type": "github" }, "original": { diff --git a/home/kakoune/kak.nix b/home/kakoune/kak.nix index da08b5c..6ed05ed 100644 --- a/home/kakoune/kak.nix +++ b/home/kakoune/kak.nix @@ -1,13 +1,6 @@ -{ config, pkgs, lib, ... }: +{ pkgs, lib, ... }: let - kak-lsp = pkgs.libs.crane.buildPackage { - src = pkgs.sources.kak-lsp; - buildInputs = (with pkgs; - lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security SystemConfiguration CoreServices ]) - ) ++ (with pkgs; [ libiconv ]); - }; - kak-lsp-frontend = { pkgs, lib, ... }: let langserver = name: { @@ -59,10 +52,20 @@ let ]; }; + ltexLsp = { pkgs, lib, ... }: { + programs.kak-lsp.languageServers.ltex-ls = { + command = "ltex-ls"; + args = [ "--log-file=/tmp" ]; + filetypes = [ "latex" "typst" ]; + roots = [ "main.tex" "main.typ" ".git" ]; + }; + + home.packages = [ pkgs.ltex-ls ]; + }; in { - imports = [ ../modules/programs/my-kakoune ./kaktex.nix kak-lsp-frontend ]; + imports = [ ../modules/programs/my-kakoune ./kaktex.nix kak-lsp-frontend ltexLsp ]; home.packages = with pkgs; [ # ctags for peneira @@ -79,7 +82,6 @@ in programs.my-kakoune.enable = true; programs.my-kakoune.enable-fish-session = true; programs.kak-lsp.enable = true; - programs.kak-lsp.package = kak-lsp; programs.kak-lsp.semanticTokens.additionalFaces = [ # Typst { face = "header"; token = "heading"; } diff --git a/overlay.nix b/overlay.nix index 293e25c..fbafd9f 100644 --- a/overlay.nix +++ b/overlay.nix @@ -94,6 +94,19 @@ let overlay-packages = final: prev: { kak-tree-sitter = final.callPackage ./packages/common/kak-tree-sitter.nix { rustPlatform = final.unstable.rustPlatform; }; + + + kak-lsp = + let + src = inputs.kak-lsp; + cargoArtifacts = final.libs.crane.buildDepsOnly { inherit src; }; + in + final.libs.crane.buildPackage { + inherit src cargoArtifacts; + buildInputs = (with final; + lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security SystemConfiguration CoreServices ]) + ) ++ (with final; [ libiconv ]); + }; }; overlay-aarch64-linux = final: prev: