Hey all. Last time I searched about how to make LazyVim “just work” in nixos (which it didn’t mostly because of mason and treesitter) was a few years ago, so maybe if I were to try to do it again nowadays I would find a better solution but anyway.
When I first switched to nixos, I already had my neovim config, and I wanted it to just work in my new system. I didn’t want to rewrite it in nix or manually install treesitter grammar packages or lsps. Alas, due to nixos not following FHS, it didn’t work.
So, a few days ago, here’s what I seem to have found as a solution: Adding this:
(pkgs.buildFHSEnv {
name = "nvim";
multiPkgs = pkgs:
with pkgs; [
libz # For codelldb to work
];
targetPkgs = pkgs:
with pkgs; [
neovim
# Whatever other things you need inside neovim
gnumake # for compiling some plugins
];
runScript = "nvim";
})
To my environment.systemPackages.
Note that I wasn’t using steam-run because I remember I got a ton of errors when I tried it a few years ago, though it seemed to work normally when I tried it just now. I still think that this is a better way to go about it than to use steam-run nvim
every time, though. I also haven’t tested this all that much, so it might have some sort of caveat I have yet to discover.
Hopefully this post helps someone.
Wow I skimmed through your config and it seemed really good! This is really simple and easy to understand. I made this post because I’d wanted to keep my lazyvim configuration, but if I were to want to completely rewrite it with nix from the ground up it’d likely either be with nixvim or something like yours!