Files
lux/modules/capabilities/neovim/default.nix
T
2026-07-25 22:16:38 +02:00

213 lines
5.4 KiB
Nix

{ config, ... }:
let
account = config.facts.account;
theme = config.facts.theme.kanagawa;
in
{
flake.modules.homeManager.default-editor-neovim =
{ pkgs, ... }:
{
xdg.mimeApps.defaultApplicationPackages = [ pkgs.neovim ];
};
flake.modules.homeManager.neovim =
{
pkgs,
config,
inputs,
osConfig,
...
}:
let
nvimTreesitter = pkgs.vimPlugins.nvim-treesitter;
svelteLanguageServer = pkgs.svelte-language-server.overrideAttrs (
finalAttrs: _: {
version = "0.18.3";
src = pkgs.fetchFromGitHub {
owner = "sveltejs";
repo = "language-tools";
tag = "svelte-language-server@${finalAttrs.version}";
hash = "sha256-FTOkJPXbsG6R53yr4n0/IR2lzFCovrdV0+epOi07lBQ=";
};
pnpmDeps = pkgs.fetchPnpmDeps {
inherit (finalAttrs)
pname
version
src
pnpmWorkspaces
;
pnpm = pkgs.pnpm_10;
fetcherVersion = 3;
hash = "sha256-fY3hrCkr/soJk1gp39/jec8lT2ZJI27xRBCZi006oWA=";
};
}
);
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=";
};
});
nvimTreesitterWithAllGrammars = nvimTreesitter.withPlugins (
_:
map (
grammar: if grammar == nvimTreesitter.builtGrammars.svelte then svelteGrammar else grammar
) nvimTreesitter.allGrammars
);
in
{
home.sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
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
taplo
yamlfmt
lua-language-server
nixd
nixfmt
dafny
vscode-langservers-extracted
tailwindcss-language-server
rust-analyzer
rustfmt
astro-language-server
tinymist
typstyle
websocat
ty
ruff
vtsls
oxlint
oxfmt
emmet-language-server
svelteLanguageServer
];
specs = {
lz-n = {
data = pkgs.vimPlugins.lz-n;
};
support = {
data = with pkgs.vimPlugins; [
plenary-nvim
kanagawa-nvim
nvimTreesitterWithAllGrammars
nvim-treesitter-textobjects
rainbow-delimiters-nvim
];
};
completion = {
lazy = true;
data = with pkgs.vimPlugins; [
blink-cmp
luasnip
friendly-snippets
colorful-menu-nvim
];
};
lsp = {
lazy = true;
data = with pkgs.vimPlugins; [
nvim-lspconfig
lazydev-nvim
nvim-navic
trouble-nvim
typst-preview-nvim
];
};
formatting = {
lazy = true;
data = with pkgs.vimPlugins; [
conform-nvim
];
};
core = {
lazy = true;
data = with pkgs.vimPlugins; [
mini-nvim
guess-indent-nvim
direnv-vim
];
};
ui = {
lazy = true;
data = with pkgs.vimPlugins; [
lualine-nvim
gitsigns-nvim
zen-mode-nvim
which-key-nvim
kulala-nvim
];
};
project = {
lazy = true;
data = with pkgs.vimPlugins; [
project-nvim
];
};
telescope = {
lazy = true;
data = with pkgs.vimPlugins; [
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
];
};
};
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 []'';
};
themeSetup = import ./_kanagawa-theme.nix {
themeName = theme.name;
};
typstPreviewDependencies = {
tinymist = "${pkgs.tinymist}/bin/tinymist";
websocat = "${pkgs.websocat}/bin/websocat";
};
};
hosts.python3.nvim-host.enable = true;
hosts.node.nvim-host.enable = true;
binName = "nvim";
};
};
}