Install treesitter grammars with nix
This commit is contained in:
parent
a115d31f07
commit
a19a1e4c98
2 changed files with 23 additions and 11 deletions
|
|
@ -709,7 +709,7 @@
|
|||
|
||||
(use-package treesit-auto
|
||||
:custom
|
||||
(treesit-auto-install 'prompt)
|
||||
(treesit-auto-install nil)
|
||||
:config
|
||||
(setq treesit-auto-langs
|
||||
'(swift
|
||||
|
|
|
|||
|
|
@ -1,17 +1,29 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
swiftTreeSitterGrammar = pkgs.tree-sitter-grammars.tree-sitter-swift;
|
||||
swiftTreeSitterLibraryName =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||
"libtree-sitter-swift.dylib"
|
||||
else
|
||||
"libtree-sitter-swift.so";
|
||||
treeSitterLibraryExtension =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin then "dylib" else "so";
|
||||
|
||||
treeSitterGrammars = {
|
||||
swift = pkgs.tree-sitter-grammars.tree-sitter-swift;
|
||||
python = pkgs.tree-sitter-grammars.tree-sitter-python;
|
||||
typescript = pkgs.tree-sitter-grammars.tree-sitter-typescript;
|
||||
tsx = pkgs.tree-sitter-grammars.tree-sitter-tsx;
|
||||
javascript = pkgs.tree-sitter-grammars.tree-sitter-javascript;
|
||||
json = pkgs.tree-sitter-grammars.tree-sitter-json;
|
||||
};
|
||||
in
|
||||
{
|
||||
home.file.".emacs.d/early-init.el".source = ./config/early-init.el;
|
||||
home.file.".emacs.d/tree-sitter/${swiftTreeSitterLibraryName}".source =
|
||||
"${swiftTreeSitterGrammar}/parser";
|
||||
home.file.".emacs.d/snippets".source = ./config/snippets;
|
||||
home.file =
|
||||
(lib.mapAttrs'
|
||||
(language: grammar:
|
||||
lib.nameValuePair
|
||||
".emacs.d/tree-sitter/libtree-sitter-${language}.${treeSitterLibraryExtension}"
|
||||
{ source = "${grammar}/parser"; })
|
||||
treeSitterGrammars)
|
||||
// {
|
||||
".emacs.d/early-init.el".source = ./config/early-init.el;
|
||||
".emacs.d/snippets".source = ./config/snippets;
|
||||
};
|
||||
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue