How do I make nvf use an lsp in a nix shell?

I’m still a beginner to using nix as a whole, and am trying to use the superhtml lsp with nvf since it is not a module in nvf. I don’t want to set anything permanently in my main configs, so is there a way to make nvf detect the lsp in a shell?

My shell.nix:

{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
  nativeBuildInputs = with pkgs.buildPackages; [
    superhtml
    htmltest
  ];
}

My nvf configs

1 Like

Did you ever figure this out?

I just came across this issue while trying to do this with Elixir, and found the new version of nvf has a very elegant solution. The default command to start the LSP is provided by calling lib.meta.getExe on the package for the lsp. But you can override this value with a simple string value so that it’s called from your shell’s $PATH instead. Which means you should be able to use a nix shell, mise, asdf, or whatever.

In my case, I set programs.nvf.settings.vim.lsp.servers.elixirls.cmd = lib.mkForce [ “elixir-ls” ] and it did the trick. Note that I had to use the mkForce command to override the default provided via NVF.