{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; nix2lua.url = "git+https://git.pleshevski.ru/mynix/nix2lua"; # Plenary (required by crates-nvim) plenary-nvim = { url = "github:nvim-lua/plenary.nvim"; flake = false; }; # config # https://github.com/gpanders/editorconfig.nvim editorconfig-nvim = { url = "github:gpanders/editorconfig.nvim"; flake = false; }; # explorer # https://github.com/kyazdani42/nvim-tree.lua nvim-tree-lua = { url = "github:kyazdani42/nvim-tree.lua"; flake = false; }; # https://github.com/nvim-telescope/telescope.nvim telescope-nvim = { url = "github:nvim-telescope/telescope.nvim"; flake = false; }; # https://github.com/nvim-telescope/telescope-live-grep-args.nvim telescope-live-grep-args-nvim = { url = "github:nvim-telescope/telescope-live-grep-args.nvim"; flake = false; }; # formatter # https://github.com/sbdchd/neoformat neoformat = { url = "github:sbdchd/neoformat"; flake = false; }; # git # https://github.com/lewis6991/gitsigns.nvim gitsigns-nvim = { url = "github:lewis6991/gitsigns.nvim"; flake = false; }; # lsp # https://github.com/neovim/nvim-lspconfig nvim-lspconfig = { url = "github:neovim/nvim-lspconfig"; flake = false; }; # https://github.com/tamago324/nlsp-settings.nvim nlsp-settings-nvim = { url = "github:tamago324/nlsp-settings.nvim"; flake = false; }; # https://github.com/glepnir/lspsaga.nvim lspsaga-nvim = { url = "github:glepnir/lspsaga.nvim?rev=f33bc99d0ed3ed691a58b3339decf4e1933c3f9e"; flake = false; }; # https://github.com/L3MON4D3/LuaSnip luasnip = { url = "github:L3MON4D3/LuaSnip"; flake = false; }; # https://github.com/hrsh7th/nvim-cmp nvim-cmp = { url = "github:hrsh7th/nvim-cmp"; flake = false; }; # https://github.com/hrsh7th/cmp-nvim-lsp cmp-nvim-lsp = { url = "github:hrsh7th/cmp-nvim-lsp"; flake = false; }; # https://github.com/saadparwaiz1/cmp_luasnip cmp-luasnip = { url = "github:saadparwaiz1/cmp_luasnip"; flake = false; }; # theme # https://github.com/nanozuki/tabby.nvim tabby-nvim = { url = "github:nanozuki/tabby.nvim"; flake = false; }; # https://github.com/nvim-lualine/lualine.nvim lualine-nvim = { url = "github:nvim-lualine/lualine.nvim"; flake = false; }; # https://github.com/arkav/lualine-lsp-progress lualine-lsp-progress = { url = "github:/arkav/lualine-lsp-progress"; flake = false; }; # https://github.com/kyazdani42/nvim-web-devicons nvim-web-devicons = { url = "github:kyazdani42/nvim-web-devicons"; flake = false; }; # https://github.com/catppuccin/nvim theme = { url = "github:catppuccin/nvim"; flake = false; }; # ux # https://github.com/phaazon/hop.nvim hop-nvim = { url = "github:phaazon/hop.nvim"; flake = false; }; # https://github.com/nvim-orgmode/orgmode nvim-orgmode = { url = "github:nvim-orgmode/orgmode?rev=fc9bb0f5823d01e4008e4b86663772d4148aa9ce"; flake = false; }; # https://github.com/akinsho/org-bullets.nvim org-bullets-nvim = { url = "github:akinsho/org-bullets.nvim"; flake = false; }; # https://github.com/norcalli/nvim-colorizer.lua nvim-colorizer = { url = "github:norcalli/nvim-colorizer.lua"; flake = false; }; # https://github.com/nzlov/cmp-tabby cmp-tabby = { url = "github:nzlov/cmp-tabby"; flake = false; }; }; outputs = inputs @ { self, nixpkgs, flake-utils, nix2lua, ... }: let inputPlugins = [ "plenary-nvim" # config "editorconfig-nvim" # explorer "nvim-tree-lua" "telescope-nvim" "telescope-live-grep-args-nvim" # formatter "neoformat" # git "gitsigns-nvim" # lsp "nvim-lspconfig" "nlsp-settings-nvim" "lspsaga-nvim" "luasnip" "nvim-cmp" "cmp-nvim-lsp" "cmp-luasnip" # theme "tabby-nvim" "lualine-nvim" "lualine-lsp-progress" "nvim-web-devicons" "theme" # ux "hop-nvim" "nvim-orgmode" "org-bullets-nvim" "nvim-colorizer" "cmp-tabby" ]; mkNvimPlugins = { lib, vimUtils, vimPlugins, ... }: let inherit (builtins) getAttr attrNames pathExists readDir; inherit (lib) listToAttrs nameValuePair; buildPlugin = name: vimUtils.buildVimPlugin { name = name; src = getAttr name inputs; patches = lib.optionals (pathExists ./patches/${name}) (map (patchName: ./patches/${name}/${patchName}) (attrNames (readDir ./patches/${name})) ); }; buildPluginValuePair = n: nameValuePair n (buildPlugin n); neovimPlugins = (listToAttrs (map buildPluginValuePair inputPlugins)) // { inherit (vimPlugins) nvim-treesitter; }; in { inherit neovimPlugins; inherit nix2lua; }; mkNeovim = pkgs: pkgs.callPackage ./neovim.nix (mkNvimPlugins pkgs); in { overlays = { default = final: prev: { myneovim = mkNeovim prev; }; }; } // flake-utils.lib.eachDefaultSystem (system: let inherit (builtins) mapAttrs; pkgs = import nixpkgs { inherit system; }; minimalNeovim = mkNeovim pkgs; recommendedNeovim = minimalNeovim.override { modules = { nvim-tree-lua = { configs = { renderer = { group_empty = true; full_name = true; }; }; keymaps = [ { mode = "n"; bind = "nt"; command = "NvimTreeToggle"; } { mode = "n"; bind = "nf"; command = "NvimTreeFindFile"; } ]; }; }; plugins = with minimalNeovim.nix2lua; { lualine-nvim = pipe [ (require "lualine") (call "setup" [{ options.ignore_focus = [ "NvimTree" ]; sections = { lualine_a = [ [ "filename" (namedField "path" 1) ] ]; lualine_b = [ "branch" "diff" "diagnostics" ]; lualine_c = [ "lsp_progress" ]; lualine_x = [ "filesize" "filetype" ]; lualine_y = [ "progress" ]; lualine_z = [ "location" "mode" ]; }; }]) ]; }; }; fullNeovim = recommendedNeovim.override { plugins = recommendedNeovim.plugins // (with minimalNeovim.nix2lua; { lspSaga.settings = { border_style = "rounded"; symbol_in_winbar.enable = false; code_action_lightbulb.enable = false; code_action_keys = { quit = ""; }; definition_action_keys = { quit = ""; }; rename_action_quit = ""; }; lspConfig = { servers = { nil_ls = { }; tsserver = { }; eslint = { }; denols = { root_dir = mkLuaRaw "root_pattern(\"deno.json\", \"deno.jsonc\")"; }; rust_analyzer = { settings.rust-analyzer = { "server.path" = "rust-analyzer"; "updates.prompt" = false; "updates.checkOnStartup" = false; "checkOnSave.enable" = true; "checkOnSave.command" = "clippy"; "cargo.autoreload" = true; }; }; }; }; tabbyml.enable = true; }); }; packages = { # default = recommendedNeovim; # full = fullNeovim; minimal = minimalNeovim; recommended = recommendedNeovim; }; in { inherit packages; devShells.default = pkgs.mkShell { packages = [ pkgs.stylua # lua formatter ]; }; }); }