nix-home/home/kakoune/kak.nix

144 lines
4.4 KiB
Nix
Raw Normal View History

2024-07-03 17:43:15 +00:00
{ pkgs, lib, ... }:
2021-09-29 21:11:33 +00:00
let
2024-04-07 15:38:13 +00:00
2021-09-29 21:11:33 +00:00
in
{
imports = [ ../modules/programs/my-kakoune ./kaktex.nix ];
home.packages = with pkgs; [
# ctags for peneira
universal-ctags
# tree-sitter for kak
kak-tree-sitter
];
# xdg.configFile."kak-tree-sitter/config.toml".source = ./kak-tree-sitter.toml;
2022-07-06 16:42:03 +00:00
# Enable the kakoune package.
2022-01-12 20:55:53 +00:00
programs.my-kakoune.enable = true;
programs.my-kakoune.enable-fish-session = true;
2021-11-09 20:59:22 +00:00
2023-06-30 22:38:24 +00:00
programs.my-kakoune.tree-sitter.extraAliases = {
# Scala stuff
method = "function";
module = "namespace";
function_call = "function";
method_call = "method";
boolean = "constant_builtin_boolean";
number = "constant_numeric";
float = "constant_numeric_float";
type_qualifier = "keyword_special";
storageclass = "keyword_storage_modifier";
conditional = "keyword_conditional";
include = "keyword_control_import";
};
2024-04-07 15:38:13 +00:00
programs.my-kakoune.tree-sitter.languages =
let
tree-sitter-go = pkgs.fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-go";
rev = "v0.20.0";
2024-07-17 14:53:19 +00:00
hash = "sha256-G7d8CHCyKDAb9j6ijRfHk/HlgPqSI+uvkuRIRRvjkHI=";
2024-04-07 15:38:13 +00:00
};
in
{
scala =
let
src = pkgs.fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-scala";
rev = "70afdd5632d57dd63a960972ab25945e353a52f6";
2024-07-17 14:53:19 +00:00
hash = "sha256-bi0Lqo/Zs2Uaz1efuKAARpEDg5Hm59oUe7eSXgL1Wow=";
2024-04-07 15:38:13 +00:00
};
in
{
grammar.src = src;
queries.src = src;
queries.path = "queries/scala";
};
haskell =
let
src = pkgs.fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-haskell";
rev = "ba0bfb0e5d8e9e31c160d287878c6f26add3ec08";
2024-07-17 14:53:19 +00:00
hash = "sha256-ZSOF0CLOn82GwU3xgvFefmh/AD2j5zz8I0t5YPwfan0=";
2024-04-07 15:38:13 +00:00
};
in
{
grammar.src = src;
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "../scanner.c" "../unicode.h" "-I" ".." ];
queries.src = src;
queries.path = "queries";
};
yaml = {
grammar.src = pkgs.fetchFromGitHub {
owner = "ikatyang";
repo = "tree-sitter-yaml";
rev = "0e36bed171768908f331ff7dff9d956bae016efb";
2024-07-17 14:53:19 +00:00
hash = "sha256-bpiT3FraOZhJaoiFWAoVJX1O+plnIi8aXOW2LwyU23M=";
2023-07-06 19:10:40 +00:00
};
2024-04-07 15:38:13 +00:00
grammar.compile.args = [ "-c" "-fpic" "../scanner.cc" "../parser.c" "-I" ".." ];
grammar.link.args = [ "-shared" "-fpic" "scanner.o" "parser.o" ];
grammar.link.flags = [ "-O3" "-lstdc++" ];
queries.src = pkgs.fetchFromGitHub {
owner = "helix-editor";
repo = "helix";
rev = "dbd248fdfa680373d94fbc10094a160aafa0f7a7";
2024-07-17 14:53:19 +00:00
hash = "sha256-wk8qVUDFXhAOi1Ibc6iBMzDCXb6t+YiWZcTd0IJybqc=";
2023-06-30 23:43:01 +00:00
};
2024-04-07 15:38:13 +00:00
queries.path = "runtime/queries/yaml";
2024-03-01 12:08:39 +00:00
};
2024-04-07 15:38:13 +00:00
templ =
let
src = pkgs.fetchFromGitHub {
owner = "vrischmann";
repo = "tree-sitter-templ";
rev = "044ad200092170727650fa6d368df66a8da98f9d";
2024-07-17 14:53:19 +00:00
hash = "sha256-hJuB3h5pp+LLfP0/7bAYH0uLVo+OQk5jpzJb3J9BNkY=";
2024-04-07 15:38:13 +00:00
};
in
{
grammar.src = src;
queries.src = pkgs.runCommandLocal "templ-tree-sitter-queries" { } ''
2024-07-17 14:53:19 +00:00
mkdir -p $out/queries
2024-04-07 15:38:13 +00:00
# copy most stuff from tree-sitter-templ
2024-07-17 14:53:19 +00:00
install -m644 ${src}/queries/templ/* $out/queries
2024-04-07 15:38:13 +00:00
# override inherited files
2024-07-17 14:53:19 +00:00
cat ${tree-sitter-go}/queries/highlights.scm ${src}/queries/templ/highlights.scm > $out/queries/highlights.scm
2024-04-07 15:38:13 +00:00
'';
2024-07-22 15:37:20 +00:00
queries.path = "queries";
2024-04-07 15:38:13 +00:00
};
go = {
grammar.src = tree-sitter-go;
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "-I" ".." ];
grammar.link.args = [ "-shared" "-fpic" "parser.o" ];
queries.src = tree-sitter-go;
queries.path = "queries";
2024-03-01 12:08:39 +00:00
};
2024-07-22 15:37:20 +00:00
hylo =
let
src = pkgs.fetchFromGitHub {
owner = "natsukagami";
repo = "tree-sitter-hylo";
rev = "494cbdff0d13cbc67348316af2efa0286dbddf6f";
hash = "sha256-R5UeoglCTl0do3VDJ/liCTeqbxU9slvmVKNRA/el2VY=";
};
in
{
grammar.src = src;
grammar.compile.args = [ "-c" "-fpic" "../parser.c" "-I" ".." ];
grammar.link.args = [ "-shared" "-fpic" "parser.o" ];
queries.src = src;
queries.path = "queries";
};
2024-03-01 12:08:39 +00:00
};
2021-09-29 21:11:33 +00:00
}
2022-04-11 18:09:07 +00:00