Cross-platform LazyVim setup: NixOS integration without home-manager

Seeking advice: Using LazyVim with NixOS while maintaining cross-platform compatibility

Current Setup

  • Using NixOS with flakes (only for package version tracking via flake.lock)
  • Managing dotfiles across multiple platforms (macOS, Linux, Android/Termux) using chezmoi
  • Previously used LunarVim (now discontinued) which worked well with Nix packaging

Requirements

  1. Need Neovim with:
    • Fully functional LSP configuration
    • Treesitter support for multiple languages
    • LazyVim as preferred distribution
  2. Must maintain consistent editor configuration across:
    • NixOS
    • macOS
    • Linux
    • Android (Termux)

Current Challenge

While I appreciate NixOS’s declarative approach, I’m facing issues with LazyVim:

  • Basic Neovim installation with LazyVim configuration works initially
  • Issues arise when compiling components (Treesitter, Mason, etc.)
  • Need a solution that doesn’t involve home-manager (as it’s not available on all my platforms)

What I’ve Tried

  • Successfully used LunarVim previously (was available as a Nix package)
  • Attempted basic Neovim package installation through NixOS configuration
  • Willing to provide system-wide compiler access for LazyVim (though not ideal for Nix)

Question

How can I maintain a consistent LazyVim setup across all platforms while properly integrating with NixOS? I’m looking for solutions that:

  • Don’t require home-manager
  • Maintain cross-platform compatibility
  • Allow proper compilation of Treesitter/Mason components

Has anyone solved this specific use case? I’d appreciate any suggestions or alternative approaches.

1 Like

Hm I’m curious, what platforms are you using that home-manager is not available on?

I am not sure such a thing exists; nvf & Nixvim are good tools. After faffing around with various things, I’ve settled on nvf. Bravo to Raf and co-devs. It is really excellent and has brought me closer to neovim

I’m using termux for android. Chezmoi allows templating for config files so I can keep the same configs across systems but specify single blocks that differ inside the file.

Mh I’m still not sold in configuring everything twice… I tried nvf (in the max configuration) and it was quite slow compared to my lunarvim config, but that might be adjustable.

Where is the main difference between nvf and nixvim?

I really don´t want to invest so much time in reconfiguring either and the project will be abondoned after a year or so :confused:

They are both Nix/Lua hybrids, where Nix manages dependency management and functionality is outsourced to Lua. But you can set up Nixvim almost exclusively in Nix. It is quite intuitive and “boil-in-the-bag”. (that is not meant in a bad way). Nvf is a bit more granular, you can get into the weeds in Lua.

As I had never ever configured Neovim in Lua, Nixvim was a good launchpad.

NVF describes itself as

Reproducible: Your configuration will behave the same anywhere. No surprises, promise!
Portable: nvf depends solely on your Nix store, and nothing else. No more global binaries! Works on all platforms, without hassle.
Customizable: There are almost no defaults to annoy you. nvf is fully customizable through the Nix module system.
Well-documented: Documentation is priority. You will never face undocumented, obscure behaviour.
Idiomatic: nvf does things :sparkles: the right way :sparkles: - the codebase is, and will, remain maintainable for myself and any contributors.

I’ve stuck the config in a Github Repo. Might help.

Thanks a lot! I guess there’s no way around configuring LazyVim for every other platform than NixOS. I’m still figuring out if I’ll go with nvf or nixvim. Can you use treesitter texobjects with nvf? On the first glance I didn’t see native plugin support for it but in nixvim…

Hi Chris,
see →

Go with Nixvim if it makes for an easier life. I am just a bit obsessed with Neovim, I think mainly because I don’t like IDE’s at all. They just aren’t ergonomic, and why have cotton when you can have silk? Neovim is just a thing of beauty. I prefer NVF because it connects you to the DNA of Neovim insofar as you need to use Lua to get it fully functional.

The thing I came up with doesn’t need nixos. It works with nix run GitHub - Mic92/dotfiles: My NixOS dotfiles
However I also integrated it into home-manager. The mason configuration also makes sure there are no random binaries pulled and it uses treesitter grammars from nixpkgs.

2 Likes