Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite.lua: couldn't connect to sql database, ERR: unable to open database file with home-manager #177

Open
poperigby opened this issue Aug 30, 2024 · 2 comments

Comments

@poperigby
Copy link

I'm trying to set this plugin up according to your instructions, but I'm running into this error:

Error detected while processing /home/cassidy/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...ck/myNeovimPackages/start/sqlite.lua/lua/sqlite/defs.lua:709: sqlite.lua: couldn't connect to sql database, ERR: unable to open database file
stack traceback:
        [C]: in function 'error'
        ...ck/myNeovimPackages/start/sqlite.lua/lua/sqlite/defs.lua:709: in function 'connect'
        ...pack/myNeovimPackages/start/sqlite.lua/lua/sqlite/db.lua:162: in function 'open'
        ...pack/myNeovimPackages/start/sqlite.lua/lua/sqlite/db.lua:215: in function 'run'
        ...ack/myNeovimPackages/start/sqlite.lua/lua/sqlite/tbl.lua:63: in function 'new'
        ...pack/myNeovimPackages/start/sqlite.lua/lua/sqlite/db.lua:128: in function 'sqlite'
        ...vimplugin-yankbank-nvim/lua/yankbank/persistence/sql.lua:11: in main chunk
        [C]: in function 'require'
        ...art/vimplugin-yankbank-nvim/lua/yankbank/persistence.lua:28: in function 'setup'
        ...ages/start/vimplugin-yankbank-nvim/lua/yankbank/init.lua:50: in function 'setup'
        /home/cassidy/.config/nvim/init.lua:6: in main chunk

Here's my configuration:

{ pkgs, ... }:

{
    programs.neovim = {
        plugins = [
            {
                plugin = pkgs.vimUtils.buildVimPlugin {
                    name = "yankbank-nvim";
                    src = pkgs.fetchFromGitHub {
                        owner = "ptdewey";
                        repo = "yankbank-nvim";
                        rev = "a568cb999bec269a64e3929d80c79aa417af89e3";
                        hash = "sha256-JOWSvjV3gG2zFwwOy5wg8zU03RrQicXxX+m6M5OSl3U=";
                    };
                };
                type = "lua";
                config = # lua
                ''
                    require("yankbank").setup({
                        persist_type = "sqlite",
                    })
                '';
            }
            {
                plugin = pkgs.vimPlugins.sqlite-lua;
                type = "lua";
                config = "vim.g.sqlite_clib_path = '${pkgs.sqlite}/lib/libsqlite3.so'";
            }
        ];
        extraPackages = [ pkgs.sqlite ];
    };
}
@rbhanot4739
Copy link

I am facing more or less a similar issue when using smart-open.nvim telescope extension which depends on this plugin. I have followed the installation instructions; however, when I try to load smart-open via telescope 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 have all the dependencies mentioned in the readme installed and available in the path. I could not find any errors in the checkhealth output as well. I did try to install libz explicitly but still getting the same error.

For the reference I am using Azure Linux which is a fedora based distro and I did install sudo dnf install sqlite sqlite-devel.

@rbhanot4739
Copy link

rbhanot4739 commented Oct 23, 2024

Update:

It turns out that the issue for me was with the version of Neovim. I had this issue when I Neovim installed from Nixhub api however when I installed it from a different provider it worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants