sourcegraph / sg.nvim

Experimental Sourcegraph + Cody plugin for Neovim
Apache License 2.0
721 stars 50 forks source link

sg-nvim-agent fails to start -- NixOS/LazyVim #202

Closed ferrumboll closed 9 months ago

ferrumboll commented 9 months ago

Hello there!

Kind of new with neovim, and I wanted to try this. I'm using LazyVim for my first set up and I want to set up Cody. I'm using NixOS but I only use dotfiles for my nvim set up and symlink to the config dir.

I tried to add it like so in another file in the plugins folder, just like I do with other plugins:

return {
  "sourcegraph/sg.nvim",
  dependencies = {
    "nvim-lua/plenary.nvim",
  },
}

and in the lazy.lua, after everything is set up I do require("sg").setup({})

The plugin gets downloaded and the build files are also downloaded, but when I restart neovim this error appears:

Spawning language server with cmd: /home/{user}/.local/share/nvim/lazy/sg.nvim/dist/sg-nvim-agent failed. The language server is either not installed, missing from PATH, or not executable.

I've tried adding the executable to path, but it only changes the error to: Spawning language server with cmd: sg-nvim-agent failed. The language server is either not installed, missing from PATH, or not executable.

and when I try to run the file from terminal, this is what it says: bash: /home/{user}/.local/share/nvim/lazy/sg.nvim/dist/sg-nvim-agent: cannot execute: required file not found

I've also tried building it myself with :SourceGraphBuild, it is successful, but it is the same error.

These are the files in that location: cody-agent.js sg-lsp sg-nvim-agent sg-x86_64-unknown-linux-gnu sg-x86_64-unknown-linux-gnu.tar.xz

Any idea what this could be?

I honestly searched the issues on this repo and on the internet but found nothing, so sorry if this is a repeat.

ferrumboll commented 9 months ago

after some more noob research I found that for NixOS I should Patchelf binaries. so nix run nixpkgs#patchelf -- --set-interpreter "$(nix eval nixpkgs#stdenv.cc.bintools.dynamicLinker --raw)" /path/to/file works!