{ config, lib, pkgs, ... }:
{
  programs.neovim = {
    enable = true;
    # ...
    extraPackages = with pkgs.vimPlugins; [
      lazy-nvim
      LazyVim

      bufferline-nvim
#      stylua
#      ripgrep
    ];
   
  extraLuaConfig =
      let
        plugins = with pkgs.vimPlugins; [
          LazyVim
          bufferline-nvim
          cmp-buffer
          cmp-nvim-lsp
          cmp-path
          cmp_luasnip
          conform-nvim
          dashboard-nvim
          dressing-nvim
          flash-nvim
          friendly-snippets
          gitsigns-nvim
          indent-blankline-nvim
          lualine-nvim
          neo-tree-nvim
          neoconf-nvim
          neodev-nvim
          noice-nvim
          nui-nvim
          nvim-cmp
          nvim-lint
          nvim-lspconfig
          nvim-notify
          nvim-spectre
          nvim-treesitter
          nvim-treesitter-context
          nvim-treesitter-textobjects
          nvim-ts-autotag
          nvim-ts-context-commentstring
          nvim-web-devicons
          persistence-nvim
          plenary-nvim
          telescope-fzf-native-nvim
          telescope-nvim
          todo-comments-nvim
          tokyonight-nvim
          trouble-nvim
          vim-illuminate
          vim-startuptime
          which-key-nvim
          { name = "LuaSnip"; path = luasnip; }
          { name = "catppuccin"; path = catppuccin-nvim; }
        ];

        mkEntryFromDrv = drv:
          if lib.isDerivation drv then { name = "${lib.getName drv}"; path = drv; }
          else drv;

        lazyPath = pkgs.linkFarm "lazy-plugins" (builtins.map mkEntryFromDrv plugins);
      in
      ''
        vim.opt.clipboard = "unnamedplus"
        vim.opt.shiftwidth = 2

        vim.opt.mousescroll = "ver:0,hor:0" 

      	vim.opt.rtp:prepend("${pkgs.vimPlugins.lazy-nvim}")

        require("lazy").setup({
          defaults = { lazy = true },
          dev = {
            path = "${lazyPath}",
            patterns = { "" },
            fallback = true,
          },
          spec = {
            { "LazyVim/LazyVim", import = "lazyvim.plugins" },
            { "nvim-telescope/telescope-fzf-native.nvim", enabled = true },
            { "mason-org/mason-lspconfig.nvim", enabled = false },
            { "mason-org/mason.nvim", enabled = false },
            --{ import = "plugins" },
            { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } },
          },
        })
 
     '';
 };
}
