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

Error on NixOs #118

Open
zDyanTB opened this issue Apr 3, 2024 · 6 comments
Open

Error on NixOs #118

zDyanTB opened this issue Apr 3, 2024 · 6 comments

Comments

@zDyanTB
Copy link

zDyanTB commented Apr 3, 2024

Been trying to get it running with Lunarvim with NixOs.
config:

{
    "AckslD/nvim-neoclip.lua",
    event = "VeryLazy",
    lazy = true,
    dependencies = {
      { 'kkharji/sqlite.lua',           module = 'sqlite' },
      { 'nvim-telescope/telescope.nvim' },
    },
    config = function()
      require('telescope').load_extension('neoclip')
      require('neoclip').setup({
        enable_persistent_history = true,
        continuous_sync = true,
      })
    end,
  },

error:

Error executing Lua callback: ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:17: l
oop or previous error loading module 'neoclip.db'                                              
stack traceback:                                                                               
        [C]: in function 'require'                                                             
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:17: in function 'update_fro
m_db'                                                                                          
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:86: in function 'pull'     
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:34: in function 'pre_get'  
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:45: in function 'get'      
        ...pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/telescope.lua:271: in function <...pack/l
azy/opt/nvim-neoclip.lua/lua/neoclip/telescope.lua:252>                                        
        ...e/pack/lazy/opt/telescope.nvim/lua/telescope/command.lua:193: in function 'run_comma
nd'                                                                                            
        ...e/pack/lazy/opt/telescope.nvim/lua/telescope/command.lua:253: in function 'load_comm
and'                                                                                           
        ...m/site/pack/lazy/opt/telescope.nvim/plugin/telescope.lua:108: in function <...m/site
/pack/lazy/opt/telescope.nvim/plugin/telescope.lua:107>  
@AckslD
Copy link
Owner

AckslD commented Apr 7, 2024

Hi @zDyanTB! Hmm, is that the whole traceback? It looks like it errors when loading neoclip.db but not sure why.

@zDyanTB
Copy link
Author

zDyanTB commented Apr 7, 2024

Yes, it its the full trace.
Maybe it's a problem that some files on Nix are read-only?

Edit: Today's error:

Error executing Lua callback: ...e/lvim/site/pack/lazy/opt/sqlite.lua/lua/sqlite/defs.lua:57: libsqlite3
.so: cannot open shared object file: No such file or directory                                          
stack traceback:                                                                                        
        [builtin#203]: at 0x7fad5b220580                                                                
        ...e/lvim/site/pack/lazy/opt/sqlite.lua/lua/sqlite/defs.lua:57: in main chunk                   
        [C]: in function 'require'                                                                      
        .../lvim/site/pack/lazy/opt/sqlite.lua/lua/sqlite/utils.lua:252: in function '__index'          
        ...are/lvim/site/pack/lazy/opt/sqlite.lua/lua/sqlite/db.lua:667: in main chunk                  
        [C]: in function 'require'                                                                      
        ...e/lvim/site/pack/lazy/opt/sqlite.lua/lua/sqlite/init.lua:66: in function '__index'           
        ...m/site/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/db.lua:23: in function 'get_tbl'           
        ...m/site/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/db.lua:35: in main chunk                   
        [C]: in function 'require'                                                                      
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:17: in function 'update_from_db'    
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:86: in function 'pull'              
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:34: in function 'pre_get'           
        ...e/pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/storage.lua:45: in function 'get'               
        ...pack/lazy/opt/nvim-neoclip.lua/lua/neoclip/telescope.lua:271: in function <...pack/lazy/opt/n
vim-neoclip.lua/lua/neoclip/telescope.lua:252>                                                          
        ...e/pack/lazy/opt/telescope.nvim/lua/telescope/command.lua:193: in function 'run_command'      
        ...e/pack/lazy/opt/telescope.nvim/lua/telescope/command.lua:253: in function 'load_command'     
        ...m/site/pack/lazy/opt/telescope.nvim/plugin/telescope.lua:108: in function <...m/site/pack/laz
y/opt/telescope.nvim/plugin/telescope.lua:107>                                           

@AckslD
Copy link
Owner

AckslD commented Apr 9, 2024

Maybe it's a problem that some files on Nix are read-only?

I wouldn't think that's an issue, it would only try to manipulate vim.fn.stdpath("data") .. "/databases/neoclip.sqlite3" which I think shouldn't be read-only?

Edit: Today's error:

What changed to get this error?

@zDyanTB
Copy link
Author

zDyanTB commented Apr 9, 2024

What changed to get this error?
Literally nothing

@AckslD
Copy link
Owner

AckslD commented Apr 9, 2024

Hmm, not fully sure what's going on but looks like sqlite is not properly installed

@Jeansidharta
Copy link
Contributor

I've recently had the same problem in NixOs and managed to figure out a solution. Here's where I found the solution: kkharji/sqlite.lua#28

Essentially, when installing sqlite through Nix, the shared library files will live in the output directory of the sqlite's derivation, inside the Nix store. In my case, it's at /nix/store/312yk1dazwk4pwrfj88csdlk9qvsgwsn-sqlite-3.45.3/lib. By default, the sqlite lua library used in this project will try to look for this library in regular linux paths, as shown here. There are many ways to override these paths, but the easiest one for me was to append to the LD_LIBRARY_PATH environtment variable the location of sqlite's shared library. In my particular case, using zsh, I just wrote in my home-manager configuration the following:

programs.zsh.initExtra = ''
  export LD_LIBRARY_PATH=${pkgs.sqlite.out}/lib:$LD_LIBRARY_PATH
'';

And it worked. I don't think this is the ideal solution though. I think the best one would use the vim.g.sqlite_clib_path variable, as defined here, but that sounds like more work I'm not willing to do right now.

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

3 participants