nixos/home/packages/helix/default.nix

97 lines
2.8 KiB
Nix

{ pkgs, ... }:
let
tree-sitter-url = "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/692b051b09935653befdb8f7ba8afdb640adf17b/runtime/queries/menhir/";
in
{
programs.helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "adwaita-dark";
editor.lsp.display-messages = true;
editor.inline-diagnostics.cursor-line = "hint";
editor.rulers = [ 81 ];
editor.gutters.layout = [
"diff"
"diagnostics"
];
keys.insert.j.k = "normal_mode";
};
languages = {
language-server.tinymist = {
config.exportPdf = "onSave";
config.outputPath = "$root/$dir/out/$name";
};
language-server.scls = {
command = "simple-completion-language-server";
config.feature_words = false;
config.feature_snippets = true;
config.snippets_first = true;
config.snippets_inline_by_word_tail = false;
config.feature_unicode_input = true;
config.feature_paths = false;
config.feature_citations = false;
environment.RUST_LOG = "info,simple-completion-language-server=info";
environment.LOG_FILE = "/tmp/completion.log";
};
language-server.ocamllsp = {
command = "ocamllsp";
args = [ "--fallback-read-dot-merlin" ];
};
language-server.menhir-lsp = {
command = "menhir-lsp";
};
language = [
{
name = "typst";
language-servers = [
"tinymist"
"scls"
];
}
{
name = "menhir";
file-types = [ "mly" ];
language-servers = [
"menhir-lsp"
"ocamllsp"
];
scope = "source.menhir";
}
];
grammar = [
{
name = "menhir";
source = {
git = "https://github.com/Kerl13/tree-sitter-menhir";
rev = "be8866a6bcc2b563ab0de895af69daeffa88fe70";
};
}
];
};
extraPackages = with pkgs; [
simple-completion-language-server
nixfmt-rfc-style
nil
];
};
home.file.helix-unicode-input = {
target = ".config/helix/unicode-input/base.toml";
source = ./base.toml;
};
home.file.helix-menhir-queries-highlights = {
target = ".config/helix/runtime/queries/menhir/highlights.scm";
source = pkgs.fetchurl {
url = tree-sitter-url + "highlights.scm";
sha256 = "1pgn6prbday0vf82g27l01233ng7i5h95vmijs65r7ynb021grkl";
};
};
home.file.helix-menhir-queries-injections = {
target = ".config/helix/runtime/queries/menhir/injections.scm";
source = pkgs.fetchurl {
url = tree-sitter-url + "injections.scm";
sha256 = "1m29zbrgrk29imha6lpn7an2c4198fi1a8l1q85ibnp5y8ds0v5v";
};
};
}