jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.61k stars 197 forks source link

Neovim installed with devbox fails to load sqlite dependencies #2377

Open rbhanot4739 opened 6 days ago

rbhanot4739 commented 6 days ago

Package name

neovim@0.10.2

What changes are you requesting?

Hello,

I am facing some issues with neovim installed globally with devbox wrt to sqlite dependencies. I am using smart-open.nvim telescope extension which depends on this sqlite nvim plugin, I have followed the installation instructions; however, when I try to load extension it fails to load with the following errors:.

 Error executing lua: ...ot/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/init.lua:66: loop or previous error loading module 'sqlite.db'
stack traceback:
    [C]: in function 'require'
    ...ot/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/init.lua:66: in function '__index'
    ...n.nvim/lua/telescope/_extensions/smart_open/dbclient.lua:28: in function 'new'
    .../share/nvim/lazy/smart-open.nvim/lua/smart-open/init.lua:29: in function 'setup'
    ...m/lazy/telescope.nvim/lua/telescope/_extensions/init.lua:20: in function '__index'
    ...bhanot/.config/nvim/lua/plugins/telescope-extensions.lua:117: in function <...bhanot/.config/nvim/lua/plugins/telescope-extensions.lua:116>
 Error  09:45:14 notify.error lazy.nvim Failed to run `config` for smart-open.nvim

...ot/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/defs.lua:57: libz.so.1: cannot open shared object file: No such file or directory

# stacktrace:
  - /sqlite.lua/lua/sqlite/defs.lua:57
  - /sqlite.lua/lua/sqlite/utils.lua:252 _in_ **__index**
  - /sqlite.lua/lua/sqlite/db.lua:667
  - /sqlite.lua/lua/sqlite/init.lua:66 _in_ **__index**
  - /smart-open.nvim/lua/telescope/_extensions/smart_open/dbclient.lua:28 _in_ **new**
  - /smart-open.nvim/lua/smart-open/init.lua:29 _in_ **setup**
  - /telescope.nvim/lua/telescope/_extensions/init.lua:64 _in_ **load_extension**
  - ~/.config/nvim/lua/plugins/telescope-extensions.lua:111 _in_ **config**

I initially thought it to be some neovim or sqlite specific issue, however when I installed the same version of neovim with a different package manager like pixi which installs the package from conda-forge this issue does not seems to occur.

This led me to think there could be some issue with devbox/nix version of neovim being not able to find the sqlite dependencies although I have those installed. Here is how my devbox.json looks

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.3/.schema/devbox.schema.json",
  "packages": [
    "tmuxinator@latest",
    "tmux@latest",
    "tealdeer@latest",
    "neovim@latest",
    "ripgrep@latest",
    "fzf@latest",
    "fd@latest",
    "lazygit@latest",
    "zoxide@latest",
    "eza@latest",
    "delta@latest",
    "bat@latest",
    "direnv@latest",
    "jq@latest",
    "yq@latest",
    "atuin@latest",
    "sqlite@latest",
    "lua@latest",
    "luajit@latest",
    "luarocks@latest",
    "sd@latest",
    "libz@latest",
    "zlib@latest"
  ],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

System Information

OS: Azure Linux(CBL/Mariner-Linux)
Version: 2.0.20240829
Arch: x86_64

Nvim verison

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713773202

Also I could not face this issue on osx so this is specific to linux when launching neovim insatalled with devbox. Let me know if any more information is required to debug/reproduce this.

Nixhub link

https://www.nixhub.io/packages/neovim

DerArkeN commented 5 days ago

I couldn't reproduce this on WSL2 Ubuntu when installing the neovim plugin according to the docs (also using lazy) with your exact global devbox configuration.

Only try I can suggest is installing the build-essential package since Azure is very lightweight. Is there any reason you are using Azure for your workstation?

apt update
apt install build-essential

If that doesn't work try to remove everything from your global devbox you don't necessarily need for neovim to work, reinstall all plugins (delete ~/.local/share/nvim) and try again.

rbhanot4739 commented 5 days ago

@DerArkeN I tried all of the options i.e. cleaning devbox installation and installing just neovim as well setting up a fresh neovim instance and nothing worked.

Is there any reason you are using Azure for your workstation?

This is my work machine provisioned by my organization. I tried installing neovim with linuxbrew as well with no other changes to my system and it works just fine. So I somehow feel there is some issue with neovim package or its dependencies available on nixhub.io which isn't playing nicely azure linux. I tried older versions as well but same issue.

DerArkeN commented 3 days ago

@rbhanot4739 sorry for the late response.

so I am assuming when you create a nix shell the same problem appears? nix-shell --packages neovim

Also which shell are you using? You have to make sure, your devbox hook is before any other hook in your rc file.