Open 99linesofcode opened 2 months ago
Hi!
I might be completely off the mark here, but I thought I saw you quite recently somewhere in NixOS spaces, asking about installing LazyVim
and being unhappy with people telling you to move to some Nix-native solution like NixVim? If so, I'm glad to be of help!
Sure, let me try to explain this bit to the best of my ability. It's been a while since I used Neovim, to be honest. So Neovim has a packpath
, which is something like a general Linux PATH
, but for Neovim plugins and packages. Nix uses a wrapper around Neovim, which resets the packpath
to some paths to /nix/store
. I think this line does a few things:
pkgs.vimUtils.packDir
function with our finalPackage.passthru.packpathDirs
, which produces a new /nix/store
path that leads to the actual packpath
/pack/myNeovimPackages/start
to it. I don't quite remember why we need it, but just step 1 is not enough, and the new path that is created here is actually expected by Neovim/nix/store
path, which makes lazy.nvim look into this directory for when a package is marked with dev
By the way, you can actually specify the allowed dev paths as a wildcard, using patterns = {""}
. This came up in https://github.com/folke/lazy.nvim/pull/1676#issuecomment-2248942233 , and I still haven't updated the blog post. My bad!
I think this is a pretty elegant approach and it seems to allow me to stay as close to the
LazyVim
defaults as possible. I read your blog post but I'm still a bit unclear on the purpose of this section in your init config. Could you explain it in more detail? Thanks for sharing!https://github.com/KFearsoff/NixOS-config/blob/6b42e069cc917112f99447a87650da9cccdc12ed/nixosModules/neovim/default.nix#L201