home/home/kak.nix
2024-06-12 22:09:20 +02:00

113 lines
3.0 KiB
Nix

{ pkgs, kak, kak-lsp ? pkgs.kak-lsp }:
with pkgs; let
kakoune-mirror = kakouneUtils.buildKakounePluginFrom2Nix {
pname = "kakoune-mirror";
version = "latest";
src = fetchFromGitHub {
owner = "Delapouite";
repo = "kakoune-mirror";
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
sha256 = "sha256-uslx4zZhvjUylrPWvTOugsKYKKpF0EEz1drc1Ckrpjk=";
};
meta.homepage = "https://github.com/Delapouite/kakoune-mirror";
};
kakoune-verilog = kakouneUtils.buildKakounePluginFrom2Nix {
pname = "kakoune-verilog";
version = "latest";
src = ../kak-verilog;
};
ad-hoc-org-mode = kakouneUtils.buildKakounePluginFrom2Nix {
pname = "ad-hoc-org-mode";
version = "latest";
src = fetchFromGitHub {
owner = "loovjo";
repo = "ad-hoc-org-mode";
rev = "e32a5d18cbe9eec244695f9e39277c90d2960147";
sha256 = "sha256-BhyrOVJxbnB0NI3BBLwNTuPc3WgeuJKjuL2CPLqX8jA=";
};
meta.homepage = "https://github.com/loovjo/ad-hoc-org-mode";
};
# NOTE: kak-lsp must be in packages
kakoune-lsp = kakouneUtils.buildKakounePluginFrom2Nix {
pname = "kakoune-lsp";
version = "latest";
src = fetchFromGitHub {
owner = "kakoune-lsp";
repo = "kakoune-lsp";
rev = "v17.0.1";
sha256 = "sha256-uXKquAjfytUn/Q0kx+0BGRQTkVMQ9rMRnTCy622upag=";
};
meta.homepage = "https://github.com/kakoune-lsp/kakoune-lsp/";
};
kak-lsp-config-file = writeText "kak-lsp.toml" ''
file_watch_support = false
snippet_support = true
[language_server.haskell]
filetypes = ["haskell"]
roots = ["hie.yaml", "cabal.project", "Setup.hs", "stack.yaml", "*.cabal"]
command = "${pkgs.haskell-language-server}/bin/haskell-language-server-wrapper"
args = ["--lsp"]
[language_server.python]
filetypes = ["python"]
roots = ["requirements.txt", "setup.py", ".git"]
command = "pylsp" # use system pylsp
[language_server.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "${pkgs.rust-analyzer}/bin/rust-analyzer"
[language_server.gleam]
filetypes = ["gleam"]
roots = ["gleam.toml"]
command = "${pkgs.glas}/bin/glas"
[language_server.english]
filetypes = ["markdown", "latex"]
roots = []
command = "${pkgs.ltex-ls}/bin/ltex-ls"
'';
kak-lsp-config-line = "set global lsp_cmd \"${kak-lsp}/bin/kak-lsp -s %val{session} --config ${kak-lsp-config-file} --log /tmp/kak-lsp.log\"";
in
{
enable = true;
package = kak;
defaultEditor = true;
plugins = with kakounePlugins; [
kakoune-buffers
kakoune-extra-filetypes
kakoune-mirror
ad-hoc-org-mode
kakoune-verilog
kakoune-lsp
];
config = {
colorScheme = "gruvbox-dark";
indentWidth = 4;
ui.assistant = "cat"; # mjau
ui.statusLine = "top";
ui.useBuiltinKeyParser = true;
ui.enableMouse = true;
wrapLines = {
enable = true;
indent = true;
word = true;
};
};
extraConfig = kak-lsp-config-line + "\n" + builtins.readFile ../dotfiles/kakrc ;
}