feat(nvim): use custom flake for hypr treesitter

This commit is contained in:
matt1432 2023-11-25 23:55:08 -05:00
parent 9dd57f8a54
commit 1f6c5f875f
3 changed files with 159 additions and 130 deletions

View file

@ -1,17 +1,11 @@
{
pkgs,
lib,
tree-sitter-hypr,
...
}: let
# installs a vim plugin from git with a given tag / branch
plugin = src:
pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName src.repo}";
version = src.rev;
inherit src;
};
fileContents = lib.strings.fileContents;
nvim-treesitter-hypr = tree-sitter-hypr.packages.${pkgs.system}.default;
in {
# TODO: make a gradle module and have java in device-vars.nix
xdg.dataFile = {
@ -134,117 +128,93 @@ in {
extraConfig = fileContents ./base.vim;
extraLuaConfig = fileContents ./base.lua;
plugins = let
# custom packages
hypr-src = pkgs.fetchFromGitHub {
owner = "luckasRanarison";
repo = "tree-sitter-hypr";
rev = "90b3ddf8a85b5ea3d9dc4920fddb16182a192e14";
hash = "sha256-ErFs2eCC0eZEyDldrTUj4JJ0Eu+exDHNQx4g8WXh/UQ=";
};
plugins = with pkgs.vimPlugins; [
# Coc configured
coc-css
coc-eslint
coc-java
coc-sh
coc-stylelintplus
{
plugin = coc-snippets;
type = "viml";
config = fileContents ./plugins/snippets.vim;
}
tree-sitter-hypr = plugin hypr-src;
## Lua
coc-sumneko-lua
neodev-nvim
hypr-grammar = pkgs.tree-sitter.buildGrammar {
language = "hypr";
src = hypr-src;
version = hypr-src.rev;
generate = true;
};
in
with pkgs.vimPlugins; [
# Coc configured
coc-css
coc-eslint
coc-java
coc-sh
coc-stylelintplus
{
plugin = coc-snippets;
type = "viml";
config = fileContents ./plugins/snippets.vim;
}
## Fzf
coc-fzf
fzfWrapper
fzf-vim
## Lua
coc-sumneko-lua
neodev-nvim
coc-highlight
coc-json
coc-pyright
coc-vimlsp
coc-yaml
coc-toml
coc-markdownlint
coc-tsserver
fugitive
## Fzf
coc-fzf
fzfWrapper
fzf-vim
{
plugin = dracula-nvim;
type = "viml";
config = fileContents ./plugins/dracula.vim;
}
{
plugin = lualine-nvim;
type = "lua";
config = fileContents ./plugins/lualine.lua;
}
{
plugin = todo-comments-nvim;
type = "lua";
config = "require('todo-comments').setup()";
}
{
plugin = gitsigns-nvim;
type = "lua";
config = fileContents ./plugins/gitsigns.lua;
}
{
plugin = nvim-autopairs;
type = "lua";
config = fileContents ./plugins/autopairs.lua;
}
nvim-treesitter-context
nvim-treesitter-textobjects
nvim-treesitter-hypr
{
plugin = nvim-treesitter.withAllGrammars;
type = "viml";
config = fileContents ./plugins/treesitter.vim;
}
{
plugin = indent-blankline-nvim;
type = "lua";
config = fileContents ./plugins/indent.lua;
}
{
plugin = mini-nvim;
type = "lua";
config = fileContents ./plugins/mini.lua;
}
{
plugin = neo-tree-nvim;
type = "viml";
config = ''
${fileContents ./plugins/neotree.vim}
coc-highlight
coc-json
coc-pyright
coc-vimlsp
coc-yaml
coc-toml
coc-markdownlint
coc-tsserver
fugitive
{
plugin = dracula-nvim;
type = "viml";
config = fileContents ./plugins/dracula.vim;
}
{
plugin = lualine-nvim;
type = "lua";
config = fileContents ./plugins/lualine.lua;
}
{
plugin = todo-comments-nvim;
type = "lua";
config = "require('todo-comments').setup()";
}
{
plugin = gitsigns-nvim;
type = "lua";
config = fileContents ./plugins/gitsigns.lua;
}
{
plugin = nvim-autopairs;
type = "lua";
config = fileContents ./plugins/autopairs.lua;
}
nvim-treesitter-context
nvim-treesitter-textobjects
{
plugin = tree-sitter-hypr;
type = "lua";
config = ''
vim.treesitter.language.require_language("hypr", "${hypr-grammar}/parser")
'';
}
{
plugin = nvim-treesitter.withAllGrammars;
type = "viml";
config = fileContents ./plugins/treesitter.vim;
}
{
plugin = indent-blankline-nvim;
type = "lua";
config = fileContents ./plugins/indent.lua;
}
{
plugin = mini-nvim;
type = "lua";
config = fileContents ./plugins/mini.lua;
}
{
plugin = neo-tree-nvim;
type = "viml";
config = ''
${fileContents ./plugins/neotree.vim}
lua << EOF
${fileContents ./plugins/neotree.lua}
EOF
'';
}
];
lua << EOF
${fileContents ./plugins/neotree.lua}
EOF
'';
}
];
};
};
}

View file

@ -207,6 +207,24 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"hercules-ci-effects": {
"inputs": {
"flake-parts": "flake-parts_2",
@ -280,11 +298,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1700941474,
"narHash": "sha256-1qI7ZMBvbVPofz8jWqNlhBgol03huMWFduSwXb/UVMY=",
"lastModified": 1700967537,
"narHash": "sha256-TzyP5xNGF+rCj2ko+E+VOpQTtzlQ4TfDLuObEPbRX6g=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "ad3f6886484e9adbab532de125e69a70c54fa13e",
"rev": "cd96ceecc551c25631783499bd92c6662c5d3616",
"type": "github"
},
"original": {
@ -447,11 +465,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1700874698,
"narHash": "sha256-45bXCKIc3BZA3q83vAJi2qcd0mdkWp4bG/AmbBx01TA=",
"lastModified": 1700961605,
"narHash": "sha256-nN5m0OhqmD0gxtpXDvXyqCPQux9L/o1Yr1ALKoaOT9o=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "9ed5f7f0e6f14fb8956ddb8c0ed345d6b4aee2c0",
"rev": "076d7864a6c2d02e41325c03ad3200a8a3739763",
"type": "github"
},
"original": {
@ -489,11 +507,11 @@
]
},
"locked": {
"lastModified": 1700363379,
"narHash": "sha256-fBEVPFwSZ6AmBE1s1oT7E9WVuqRghruxTnSQ8UUlMkw=",
"lastModified": 1700968077,
"narHash": "sha256-Lax+2g7G3Fe+ckMrHLYTl+97unbmNDmN1qS9MLBkxr4=",
"owner": "Mic92",
"repo": "nix-index-database",
"rev": "27920146e671a0d565aaa7452907383be14d8d82",
"rev": "bd3aec0ecb0fdde863a7ed2c6caa220c47e22c07",
"type": "github"
},
"original": {
@ -610,11 +628,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1700108881,
"narHash": "sha256-+Lqybl8kj0+nD/IlAWPPG/RDTa47gff9nbei0u7BntE=",
"lastModified": 1700856099,
"narHash": "sha256-RnEA7iJ36Ay9jI0WwP+/y4zjEhmeN6Cjs9VOFBH7eVQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7414e9ee0b3e9903c24d3379f577a417f0aae5f1",
"rev": "0bd59c54ef06bc34eca01e37d689f5e46b3fe2f1",
"type": "github"
},
"original": {
@ -706,11 +724,11 @@
},
"nur": {
"locked": {
"lastModified": 1700955854,
"narHash": "sha256-dRl/Q8CehO/W+YF06rurH5oxt75Jc9TrUmtIc8eCC2c=",
"lastModified": 1700973070,
"narHash": "sha256-xYun1OP1lmhi94JzFXajEKj0ipO6cmKVpVZXZP3lSH0=",
"owner": "nix-community",
"repo": "NUR",
"rev": "6d06cec40da7895c8e5278be921c785ffcb6e2ea",
"rev": "9a5c43cffc04beb342e4f0299b5b31c87db39b38",
"type": "github"
},
"original": {
@ -752,7 +770,8 @@
"nixpkgs": "nixpkgs_4",
"nixpkgs-wayland": "nixpkgs-wayland",
"nur": "nur",
"nurl": "nurl"
"nurl": "nurl",
"tree-sitter-hypr": "tree-sitter-hypr"
}
},
"systems": {
@ -800,6 +819,42 @@
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"tree-sitter-hypr": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1700973902,
"narHash": "sha256-Zp/I8/ZUXEl9KkVMdOvAJhiIgDRYK0vFzi0JBtzbHYg=",
"owner": "matt1432",
"repo": "tree-sitter-hypr",
"rev": "abbdfe0418f898a8a7f289c97e6ed15f1b9dfae8",
"type": "github"
},
"original": {
"owner": "matt1432",
"repo": "tree-sitter-hypr",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [

View file

@ -35,6 +35,10 @@
url = "github:matt1432/coc-stylelintplus";
inputs.nixpkgs.follows = "nixpkgs";
};
tree-sitter-hypr = {
url = "github:matt1432/tree-sitter-hypr";
inputs.nixpkgs.follows = "nixpkgs";
};
nh.url = "github:viperML/nh";
nix-melt.url = "github:nix-community/nix-melt";