this post was submitted on 11 Jul 2025
1 points (100.0% liked)

Nix / NixOS

2336 readers
4 users here now

Main links

Videos

founded 2 years ago
MODERATORS
 

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.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here