bartman's blog

Nix Neovim Overlay

bartman
Table of Contents

title #

I run NixOS, my configuration is quite conservative (stable release), but I do occasionally install from unstable.

Neovim v0.12 just dropped and I wanted to switch to it. NixOS has not yet updated v0.12 (not even in unstable).

I wanted to build my own Neovim v0.12 using overlays…

Here is a snippet from the configuration…

 1{
 2  nixpkgs.overlays = [
 3    (self: super: {
 4      neovim-unwrapped = super.neovim-unwrapped.overrideAttrs (oldAttrs: {
 5        version = "0.12.0";
 6        src = super.fetchFromGitHub {
 7          owner = "neovim";
 8          repo = "neovim";
 9          rev = "v0.12.0";
10          sha256 = "uWhrGAwQ2nnAkyJ46qGkYxJ5K1jtyUIQOAVu3yTlquk=";
11        };
12      });
13    })
14  ];
15}

You can paste the inner-block into your configuration.nix. I actually import the file into my configuration.nix using an import, as it makes it easier to comment out.

1{
2    imports = [ overlays/neovim.nix ];
3}

Then we kick off a build (note that this will build neovim, and anything that depends on neovim, so it might take a bit)…

1❯ nixos-rebuild build --flake .

and we have the new neovim…

1❯ nvim --version
2NVIM v0.12.0
3Build type: Release
4LuaJIT 2.1.1741730670
5Run "nvim -V1 -v" for more info
Tags:
Categories: