Files
lux/modules/capabilities/neovim/default.nix
T

228 lines
5.3 KiB
Nix

{ config, ... }:
let
account = config.facts.account;
in
{
flake.modules.homeManager.neovim =
{
pkgs,
config,
inputs,
osConfig,
...
}:
let
nvimTreesitter = pkgs.vimPlugins.nvim-treesitter;
svelteLanguageServer = import ../_svelte-language-server.nix { inherit pkgs; };
svelteGrammar = nvimTreesitter.builtGrammars.svelte.overrideAttrs (_: {
version = "0.0.0+rev=c2457b9";
src = pkgs.fetchFromGitHub {
owner = "m4rch3n1ng";
repo = "tree-sitter-svelte";
rev = "c2457b99a5b8ee38e14928dceeb246a61c097b77";
hash = "sha256-RIAe30TTzZhHuXxC2VRVk/X73Qm1u2LWOW3AsnUfRzI=";
};
});
nvimTreesitterWithGrammars = nvimTreesitter.withPlugins (
grammars: with grammars; [
astro
css
html
http
javascript
jsdoc
json
lua
markdown
markdown_inline
nix
python
query
regex
rust
sql
svelteGrammar
toml
tsx
typescript
typst
vim
vimdoc
yaml
]
);
in
{
imports = [
(inputs.nix-wrapper-modules.lib.getInstallModule {
name = "neovim";
value = inputs.nix-wrapper-modules.lib.wrapperModules.neovim;
})
];
wrappers.neovim = {
enable = true;
settings.config_directory = ./lua-config;
runtimePkgs = with pkgs; [
ripgrep
fd
wl-clipboard
stylua
nixfmt
oxfmt
taplo
yamlfmt
rustfmt
typstyle
ruff
lua-language-server
nixd
vscode-langservers-extracted
yaml-language-server
vtsls
svelteLanguageServer
tailwindcss-language-server
emmet-language-server
oxlint
rust-analyzer
astro-language-server
tinymist
ty
postgresql
mariadb
mongosh
kulala-core
kulala-fmt
curl
jq
openssl
zk
];
specs = {
lz-n.data = pkgs.vimPlugins.lz-n;
editing = {
lazy = true;
data = with pkgs.vimPlugins; [
mini-nvim
guess-indent-nvim
nvimTreesitterWithGrammars
nvim-treesitter-textobjects
rainbow-delimiters-nvim
nvim-ts-autotag
grug-far-nvim
];
};
navigation = {
lazy = true;
data = with pkgs.vimPlugins; [
plenary-nvim
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
{
data = oil-nvim;
lazy = false;
}
];
};
diagnostics = {
lazy = true;
data = with pkgs.vimPlugins; [ trouble-nvim ];
};
lsp = {
lazy = true;
data = with pkgs.vimPlugins; [
nvim-lspconfig
lazydev-nvim
nvim-navic
SchemaStore-nvim
];
};
completion = {
lazy = true;
data = with pkgs.vimPlugins; [
blink-cmp
colorful-menu-nvim
friendly-snippets
{
data = blink-compat;
lazy = false;
}
];
};
formatting = {
lazy = true;
data = with pkgs.vimPlugins; [ conform-nvim ];
};
ui = {
lazy = true;
data = with pkgs.vimPlugins; [
render-markdown-nvim
lualine-nvim
gitsigns-nvim
zen-mode-nvim
which-key-nvim
];
};
database = {
lazy = true;
data = with pkgs.vimPlugins; [
vim-dadbod
vim-dadbod-completion
vim-dadbod-ui
];
};
http = {
lazy = true;
data = with pkgs.vimPlugins; [ kulala-nvim ];
};
notes = {
lazy = true;
data = with pkgs.vimPlugins; [ zk-nvim ];
};
};
env.ZK_NOTEBOOK_DIR = "${config.home.homeDirectory}/sync/notes";
settings = {
nixdExtras = {
nixpkgs = "import ${pkgs.path} {}";
nixos_options = ''(builtins.getFlake "path://${account.nixosConfigurationPath}").nixosConfigurations.${osConfig.facts.machine.name}.options'';
home_manager_options = ''(builtins.getFlake "path://${account.nixosConfigurationPath}").nixosConfigurations.${osConfig.facts.machine.name}.options.home-manager.users.type.getSubOptions []'';
};
kulalaCorePath = "${pkgs.kulala-core}/bin/kulala-core";
};
};
};
flake.modules.homeManager.primary-editor-neovim =
{ pkgs, ... }:
{
imports = [ config.flake.modules.homeManager.neovim ];
home.sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
xdg.mimeApps.defaultApplicationPackages = [ pkgs.neovim ];
};
}