From d0e206186d7d4d2d91ff02a6733bfb5b128d916c Mon Sep 17 00:00:00 2001 From: KoenDR06 Date: Mon, 26 Aug 2024 12:25:58 +0200 Subject: [PATCH] Added Lazyvim --- flake.lock | 24 ++++---- home-manager/apps.nix | 1 + home-manager/neovim.nix | 124 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 home-manager/neovim.nix diff --git a/flake.lock b/flake.lock index 4e32c11..a1b1dd6 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1722630065, - "narHash": "sha256-QfM/9BMRkCmgWzrPDK+KbgJOUlSJnfX4OvsUupEUZvA=", + "lastModified": 1723399884, + "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", "owner": "nix-community", "repo": "home-manager", - "rev": "afc892db74d65042031a093adb6010c4c3378422", + "rev": "086f619dd991a4d355c07837448244029fc2d9ab", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722630782, - "narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=", + "lastModified": 1723175592, + "narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d04953086551086b44b6f3c6b7eeb26294f207da", + "rev": "5e0ca22929f3342b19569b21b2f3462f053e497b", "type": "github" }, "original": { @@ -62,11 +62,11 @@ ] }, "locked": { - "lastModified": 1722804745, - "narHash": "sha256-l6N3QaiDqN2QmHDAxjczQPLPCTv+Kp7PsrtJBltmhTo=", + "lastModified": 1723391864, + "narHash": "sha256-nX/aloqD8ZHcuPS7sk7fx1txTaXCi+o6iYm0mIX4uIE=", "owner": "pjones", "repo": "plasma-manager", - "rev": "61d9342fb471cd3c45a047406428fba7b6fb49ad", + "rev": "f843f4258eea57c5ba60f6ce1d96d12d6494b56e", "type": "github" }, "original": { @@ -91,11 +91,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1722114803, - "narHash": "sha256-s6YhI8UHwQvO4cIFLwl1wZ1eS5Cuuw7ld2VzUchdFP0=", + "lastModified": 1722897572, + "narHash": "sha256-3m/iyyjCdRBF8xyehf59QlckIcmShyTesymSb+N4Ap4=", "owner": "Mic92", "repo": "sops-nix", - "rev": "eb34eb588132d653e4c4925d862f1e5a227cc2ab", + "rev": "8ae477955dfd9cbf5fa4eb82a8db8ddbb94e79d9", "type": "github" }, "original": { diff --git a/home-manager/apps.nix b/home-manager/apps.nix index 30ba521..0939b2f 100644 --- a/home-manager/apps.nix +++ b/home-manager/apps.nix @@ -7,6 +7,7 @@ ... }: { imports = [ + ./neovim.nix ./plasma.nix ./gnome.nix ]; diff --git a/home-manager/neovim.nix b/home-manager/neovim.nix new file mode 100644 index 0000000..b5b1e41 --- /dev/null +++ b/home-manager/neovim.nix @@ -0,0 +1,124 @@ +{ config, lib, pkgs, ... }: + +{ + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + extraPackages = with pkgs; [ + # LazyVim + lua-language-server + stylua + # Telescope + ripgrep + ]; + + plugins = with pkgs.vimPlugins; [ + lazy-nvim + ]; + + extraLuaConfig = + let + plugins = with pkgs.vimPlugins; [ + # LazyVim + 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; } + { name = "mini.ai"; path = mini-nvim; } + { name = "mini.bufremove"; path = mini-nvim; } + { name = "mini.comment"; path = mini-nvim; } + { name = "mini.indentscope"; path = mini-nvim; } + { name = "mini.pairs"; path = mini-nvim; } + { name = "mini.surround"; path = mini-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 + '' + require("lazy").setup({ + defaults = { + lazy = true, + }, + dev = { + -- reuse files from pkgs.vimPlugins.* + path = "${lazyPath}", + patterns = { "." }, + -- fallback to download + fallback = true, + }, + spec = { + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- The following configs are needed for fixing lazyvim on nix + -- force enable telescope-fzf-native.nvim + { "nvim-telescope/telescope-fzf-native.nvim", enabled = true }, + -- disable mason.nvim, use programs.neovim.extraPackages + { "williamboman/mason-lspconfig.nvim", enabled = false }, + { "williamboman/mason.nvim", enabled = false }, + -- import/override with your plugins + { import = "plugins" }, + -- treesitter handled by xdg.configFile."nvim/parser", put this line at the end of spec to clear ensure_installed + { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } }, + }, + }) + ''; + }; + + # https://github.com/nvim-treesitter/nvim-treesitter#i-get-query-error-invalid-node-type-at-position + xdg.configFile."nvim/parser".source = + let + parsers = pkgs.symlinkJoin { + name = "treesitter-parsers"; + paths = (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with plugins; [ + c + lua + ])).dependencies; + }; + in + "${parsers}/parser"; + + # Normal LazyVim config here, see https://github.com/LazyVim/starter/tree/main/lua + xdg.configFile."nvim/lua".source = ../config/lua; +}