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
|
(use-package treesit-auto
|
||||||
:custom
|
:custom
|
||||||
(treesit-auto-install 'prompt)
|
(treesit-auto-install nil)
|
||||||
:config
|
:config
|
||||||
(setq treesit-auto-langs
|
(setq treesit-auto-langs
|
||||||
'(swift
|
'(swift
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,29 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
swiftTreeSitterGrammar = pkgs.tree-sitter-grammars.tree-sitter-swift;
|
treeSitterLibraryExtension =
|
||||||
swiftTreeSitterLibraryName =
|
if pkgs.stdenv.hostPlatform.isDarwin then "dylib" else "so";
|
||||||
if pkgs.stdenv.hostPlatform.isDarwin then
|
|
||||||
"libtree-sitter-swift.dylib"
|
treeSitterGrammars = {
|
||||||
else
|
swift = pkgs.tree-sitter-grammars.tree-sitter-swift;
|
||||||
"libtree-sitter-swift.so";
|
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
|
in
|
||||||
{
|
{
|
||||||
home.file.".emacs.d/early-init.el".source = ./config/early-init.el;
|
home.file =
|
||||||
home.file.".emacs.d/tree-sitter/${swiftTreeSitterLibraryName}".source =
|
(lib.mapAttrs'
|
||||||
"${swiftTreeSitterGrammar}/parser";
|
(language: grammar:
|
||||||
home.file.".emacs.d/snippets".source = ./config/snippets;
|
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 = {
|
programs.emacs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue