{ 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; 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 svelte-language-server ]; 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"; }; }; }