├── .gitignore ├── README.md ├── default.nix ├── flake.lock └── flake.nix /.gitignore: -------------------------------------------------------------------------------- 1 | /result 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Setup LazyVim using NixVim 2 | 3 | A [Nix flake][1] to setup [LazyVim][2] using [NixVim][3] 4 | 5 | [1]: https://wiki.nixos.org/wiki/Flakes 6 | [2]: http://www.lazyvim.org 7 | [3]: https://github.com/nix-community/nixvim 8 | 9 | ### Quick test 10 | 11 | ``` 12 | nix run github:azuwis/lazyvim-nixvim 13 | ``` 14 | 15 | ### Use in `nix shell` 16 | 17 | ``` 18 | nix shell github:azuwis/lazyvim-nixvim 19 | nvim 20 | ``` 21 | 22 | ### Use in `nix-shell` 23 | 24 | ``` 25 | nix-shell https://github.com/azuwis/lazyvim-nixvim/archive/refs/heads/master.zip 26 | nvim 27 | ``` 28 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | (import ( 2 | let 3 | lock = builtins.fromJSON (builtins.readFile ./flake.lock); 4 | in 5 | fetchTarball { 6 | url = 7 | lock.nodes.flake-compat.locked.url 8 | or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; 9 | sha256 = lock.nodes.flake-compat.locked.narHash; 10 | } 11 | ) { src = ./.; }).defaultNix 12 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "devshell": { 4 | "inputs": { 5 | "nixpkgs": [ 6 | "nixvim", 7 | "nixpkgs" 8 | ] 9 | }, 10 | "locked": { 11 | "lastModified": 1728330715, 12 | "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", 13 | "owner": "numtide", 14 | "repo": "devshell", 15 | "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", 16 | "type": "github" 17 | }, 18 | "original": { 19 | "owner": "numtide", 20 | "repo": "devshell", 21 | "type": "github" 22 | } 23 | }, 24 | "flake-compat": { 25 | "locked": { 26 | "lastModified": 1696426674, 27 | "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", 28 | "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", 29 | "revCount": 57, 30 | "type": "tarball", 31 | "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" 32 | }, 33 | "original": { 34 | "type": "tarball", 35 | "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" 36 | } 37 | }, 38 | "flake-parts": { 39 | "inputs": { 40 | "nixpkgs-lib": [ 41 | "nixpkgs" 42 | ] 43 | }, 44 | "locked": { 45 | "lastModified": 1730504689, 46 | "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", 47 | "owner": "hercules-ci", 48 | "repo": "flake-parts", 49 | "rev": "506278e768c2a08bec68eb62932193e341f55c90", 50 | "type": "github" 51 | }, 52 | "original": { 53 | "owner": "hercules-ci", 54 | "repo": "flake-parts", 55 | "type": "github" 56 | } 57 | }, 58 | "flake-utils": { 59 | "inputs": { 60 | "systems": "systems" 61 | }, 62 | "locked": { 63 | "lastModified": 1731533236, 64 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 65 | "owner": "numtide", 66 | "repo": "flake-utils", 67 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 68 | "type": "github" 69 | }, 70 | "original": { 71 | "owner": "numtide", 72 | "repo": "flake-utils", 73 | "type": "github" 74 | } 75 | }, 76 | "git-hooks": { 77 | "inputs": { 78 | "flake-compat": [ 79 | "nixvim", 80 | "flake-compat" 81 | ], 82 | "gitignore": "gitignore", 83 | "nixpkgs": [ 84 | "nixvim", 85 | "nixpkgs" 86 | ], 87 | "nixpkgs-stable": [ 88 | "nixvim", 89 | "nixpkgs" 90 | ] 91 | }, 92 | "locked": { 93 | "lastModified": 1732021966, 94 | "narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=", 95 | "owner": "cachix", 96 | "repo": "git-hooks.nix", 97 | "rev": "3308484d1a443fc5bc92012435d79e80458fe43c", 98 | "type": "github" 99 | }, 100 | "original": { 101 | "owner": "cachix", 102 | "repo": "git-hooks.nix", 103 | "type": "github" 104 | } 105 | }, 106 | "gitignore": { 107 | "inputs": { 108 | "nixpkgs": [ 109 | "nixvim", 110 | "git-hooks", 111 | "nixpkgs" 112 | ] 113 | }, 114 | "locked": { 115 | "lastModified": 1709087332, 116 | "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", 117 | "owner": "hercules-ci", 118 | "repo": "gitignore.nix", 119 | "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", 120 | "type": "github" 121 | }, 122 | "original": { 123 | "owner": "hercules-ci", 124 | "repo": "gitignore.nix", 125 | "type": "github" 126 | } 127 | }, 128 | "home-manager": { 129 | "inputs": { 130 | "nixpkgs": [ 131 | "nixvim", 132 | "nixpkgs" 133 | ] 134 | }, 135 | "locked": { 136 | "lastModified": 1732884235, 137 | "narHash": "sha256-r8j6R3nrvwbT1aUp4EPQ1KC7gm0pu9VcV1aNaB+XG6Q=", 138 | "owner": "nix-community", 139 | "repo": "home-manager", 140 | "rev": "819f682269f4e002884702b87e445c82840c68f2", 141 | "type": "github" 142 | }, 143 | "original": { 144 | "owner": "nix-community", 145 | "repo": "home-manager", 146 | "type": "github" 147 | } 148 | }, 149 | "ixx": { 150 | "inputs": { 151 | "flake-utils": [ 152 | "nixvim", 153 | "nuschtosSearch", 154 | "flake-utils" 155 | ], 156 | "nixpkgs": [ 157 | "nixvim", 158 | "nuschtosSearch", 159 | "nixpkgs" 160 | ] 161 | }, 162 | "locked": { 163 | "lastModified": 1729958008, 164 | "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", 165 | "owner": "NuschtOS", 166 | "repo": "ixx", 167 | "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", 168 | "type": "github" 169 | }, 170 | "original": { 171 | "owner": "NuschtOS", 172 | "ref": "v0.0.6", 173 | "repo": "ixx", 174 | "type": "github" 175 | } 176 | }, 177 | "nix-darwin": { 178 | "inputs": { 179 | "nixpkgs": [ 180 | "nixvim", 181 | "nixpkgs" 182 | ] 183 | }, 184 | "locked": { 185 | "lastModified": 1732603785, 186 | "narHash": "sha256-AEjWTJwOmSnVYsSJCojKgoguGfFfwel6z/6ud6UFMU8=", 187 | "owner": "lnl7", 188 | "repo": "nix-darwin", 189 | "rev": "6ab87b7c84d4ee873e937108c4ff80c015a40c7a", 190 | "type": "github" 191 | }, 192 | "original": { 193 | "owner": "lnl7", 194 | "repo": "nix-darwin", 195 | "type": "github" 196 | } 197 | }, 198 | "nixpkgs": { 199 | "locked": { 200 | "lastModified": 1732981179, 201 | "narHash": "sha256-F7thesZPvAMSwjRu0K8uFshTk3ZZSNAsXTIFvXBT+34=", 202 | "owner": "NixOS", 203 | "repo": "nixpkgs", 204 | "rev": "62c435d93bf046a5396f3016472e8f7c8e2aed65", 205 | "type": "github" 206 | }, 207 | "original": { 208 | "owner": "NixOS", 209 | "ref": "nixos-24.11", 210 | "repo": "nixpkgs", 211 | "type": "github" 212 | } 213 | }, 214 | "nixvim": { 215 | "inputs": { 216 | "devshell": "devshell", 217 | "flake-compat": "flake-compat", 218 | "flake-parts": [ 219 | "flake-parts" 220 | ], 221 | "git-hooks": "git-hooks", 222 | "home-manager": "home-manager", 223 | "nix-darwin": "nix-darwin", 224 | "nixpkgs": [ 225 | "nixpkgs" 226 | ], 227 | "nuschtosSearch": "nuschtosSearch", 228 | "treefmt-nix": "treefmt-nix" 229 | }, 230 | "locked": { 231 | "lastModified": 1733098942, 232 | "narHash": "sha256-RnDTSTRYcfgqrkBPNN7uvojwRzEKPYiZaFg9VQ4m7hQ=", 233 | "owner": "nix-community", 234 | "repo": "nixvim", 235 | "rev": "838829c8f9cb238a915fe3d6ac36df1a3f040d2c", 236 | "type": "github" 237 | }, 238 | "original": { 239 | "owner": "nix-community", 240 | "repo": "nixvim", 241 | "type": "github" 242 | } 243 | }, 244 | "nuschtosSearch": { 245 | "inputs": { 246 | "flake-utils": "flake-utils", 247 | "ixx": "ixx", 248 | "nixpkgs": [ 249 | "nixvim", 250 | "nixpkgs" 251 | ] 252 | }, 253 | "locked": { 254 | "lastModified": 1731936508, 255 | "narHash": "sha256-z0BSSf78LkxIrrFXZYmCoRRAxAmxMUKpK7CyxQRvkZI=", 256 | "owner": "NuschtOS", 257 | "repo": "search", 258 | "rev": "fe07070f811b717a4626d01fab714a87d422a9e1", 259 | "type": "github" 260 | }, 261 | "original": { 262 | "owner": "NuschtOS", 263 | "repo": "search", 264 | "type": "github" 265 | } 266 | }, 267 | "root": { 268 | "inputs": { 269 | "flake-parts": "flake-parts", 270 | "nixpkgs": "nixpkgs", 271 | "nixvim": "nixvim" 272 | } 273 | }, 274 | "systems": { 275 | "locked": { 276 | "lastModified": 1681028828, 277 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 278 | "owner": "nix-systems", 279 | "repo": "default", 280 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 281 | "type": "github" 282 | }, 283 | "original": { 284 | "owner": "nix-systems", 285 | "repo": "default", 286 | "type": "github" 287 | } 288 | }, 289 | "treefmt-nix": { 290 | "inputs": { 291 | "nixpkgs": [ 292 | "nixvim", 293 | "nixpkgs" 294 | ] 295 | }, 296 | "locked": { 297 | "lastModified": 1732894027, 298 | "narHash": "sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII+oAc=", 299 | "owner": "numtide", 300 | "repo": "treefmt-nix", 301 | "rev": "6209c381904cab55796c5d7350e89681d3b2a8ef", 302 | "type": "github" 303 | }, 304 | "original": { 305 | "owner": "numtide", 306 | "repo": "treefmt-nix", 307 | "type": "github" 308 | } 309 | } 310 | }, 311 | "root": "root", 312 | "version": 7 313 | } 314 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Setup LazyVim using NixVim"; 3 | 4 | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; 5 | inputs.nixvim.url = "github:nix-community/nixvim"; 6 | inputs.nixvim.inputs.nixpkgs.follows = "nixpkgs"; 7 | inputs.nixvim.inputs.flake-parts.follows = "flake-parts"; 8 | inputs.flake-parts.url = "github:hercules-ci/flake-parts"; 9 | inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; 10 | 11 | outputs = { self, nixpkgs, nixvim, flake-parts } @ inputs: 12 | flake-parts.lib.mkFlake { inherit inputs; } { 13 | systems = [ 14 | "aarch64-darwin" 15 | "aarch64-linux" 16 | "x86_64-darwin" 17 | "x86_64-linux" 18 | ]; 19 | 20 | perSystem = { pkgs, lib, system, ... }: 21 | let 22 | config = { 23 | # Reduce closure size 24 | enableMan = false; 25 | withPython3 = false; 26 | withRuby = false; 27 | 28 | extraPackages = with pkgs; [ 29 | # LazyVim 30 | lua-language-server 31 | stylua 32 | # Telescope 33 | ripgrep 34 | ]; 35 | 36 | extraPlugins = [ pkgs.vimPlugins.lazy-nvim ]; 37 | 38 | extraConfigLua = 39 | let 40 | plugins = with pkgs.vimPlugins; [ 41 | # LazyVim 42 | LazyVim 43 | bufferline-nvim 44 | cmp-buffer 45 | cmp-nvim-lsp 46 | cmp-path 47 | conform-nvim 48 | dashboard-nvim 49 | dressing-nvim 50 | flash-nvim 51 | friendly-snippets 52 | gitsigns-nvim 53 | grug-far-nvim 54 | indent-blankline-nvim 55 | lazydev-nvim 56 | lualine-nvim 57 | luvit-meta 58 | neo-tree-nvim 59 | noice-nvim 60 | nui-nvim 61 | nvim-cmp 62 | nvim-lint 63 | nvim-lspconfig 64 | nvim-snippets 65 | nvim-treesitter 66 | nvim-treesitter-textobjects 67 | nvim-ts-autotag 68 | persistence-nvim 69 | plenary-nvim 70 | snacks-nvim 71 | telescope-fzf-native-nvim 72 | telescope-nvim 73 | todo-comments-nvim 74 | tokyonight-nvim 75 | trouble-nvim 76 | ts-comments-nvim 77 | which-key-nvim 78 | { name = "catppuccin"; path = catppuccin-nvim; } 79 | { name = "mini.ai"; path = mini-nvim; } 80 | { name = "mini.icons"; path = mini-nvim; } 81 | { name = "mini.pairs"; path = mini-nvim; } 82 | ]; 83 | mkEntryFromDrv = drv: 84 | if lib.isDerivation drv then 85 | { name = "${lib.getName drv}"; path = drv; } 86 | else 87 | drv; 88 | lazyPath = pkgs.linkFarm "lazy-plugins" (builtins.map mkEntryFromDrv plugins); 89 | in 90 | '' 91 | require("lazy").setup({ 92 | defaults = { 93 | lazy = true, 94 | }, 95 | dev = { 96 | -- reuse files from pkgs.vimPlugins.* 97 | path = "${lazyPath}", 98 | patterns = { "" }, 99 | -- fallback to download 100 | fallback = true, 101 | }, 102 | spec = { 103 | { "LazyVim/LazyVim", import = "lazyvim.plugins" }, 104 | -- The following configs are needed for fixing lazyvim on nix 105 | -- force enable telescope-fzf-native.nvim 106 | { "nvim-telescope/telescope-fzf-native.nvim", enabled = true }, 107 | -- disable mason.nvim, use config.extraPackages 108 | { "williamboman/mason-lspconfig.nvim", enabled = false }, 109 | { "williamboman/mason.nvim", enabled = false }, 110 | -- uncomment to import/override with your plugins 111 | -- { import = "plugins" }, 112 | -- put this line at the end of spec to clear ensure_installed 113 | { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) opts.ensure_installed = {} end }, 114 | }, 115 | }) 116 | ''; 117 | }; 118 | nixvim' = nixvim.legacyPackages."${system}"; 119 | nvim = nixvim'.makeNixvim config; 120 | in 121 | { 122 | packages = { 123 | inherit nvim; 124 | default = nvim; 125 | }; 126 | }; 127 | }; 128 | } 129 | --------------------------------------------------------------------------------