../neovim-on-nixos

Using neovim on nixos

Here are some tips related to developing/debugging a program on nixpkgs, more specifically [neovim].

I have a hybrid nix/imperative setup to maintain a robust core of features (managed in nix via home-manager) while being able to easily test/iterate new plugins (vim-plug/packer).

I would like to mention that it is possible to maintain an out-of-nixpkgs list of neovim plugins [as explained in nixpkgs manual][nixpkgs-manual-neovim].

Debug on nix

Debugging can be tricky on nix. Programs are built in a sandbox and when compiled with debug symbols, once opening a backtrace, paths reference non-existing files such as /build/src/

Clone the repository in 'REPO' since we need the source code.

$ nix develop 'github:nix-community/neovim-nightly-overlay'

Then reproduce yor crash. Once the process has crashed

Note: As I usually have several neovim instances running concurrently, I like to see the process ID in the title bar: set titlestring=%{getpid().':'.getcwd()}

Open your backtrace with gdb as you are used to, for instance with: coredumpctl debug

If you check out the backtrace, you get:

TODO

Trying to look at the source code is not helpful (yet):

Happily, gdb can replace prefixes of path with your suggestion:

set substitute-path /build/ ~/neovim

References:

nixos wiki on neovim nixos doc to maintain your own neovim overlay nixpkgs-manual-neovim