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

Broken config on nixos-stable #40

Closed
Alexnortung opened this issue Sep 27, 2022 · 17 comments · Fixed by #44
Closed

Broken config on nixos-stable #40

Alexnortung opened this issue Sep 27, 2022 · 17 comments · Fixed by #44
Labels
bug Something isn't working

Comments

@Alexnortung
Copy link
Contributor

Hello, I have just tried to update nixvim in my personal flake. However it seems to be broken, when using the home manager module.

I am getting the following errors

Error detected while processing /nix/store/hgclrlyxzazx8b5324qcrkrbm5zfjq25-init.vim:
line    6:
E185: Cannot find color scheme 'nord'
line  396:
E5108: Error executing lua [string ":lua"]:20: module 'cmp' not found:
        no field package.preload['cmp']
        no file '/nix/store/vmln39q308xpq0awd1b5j84i8l58l857-luajit-2.1.0-2022-04-05-env/share/lua/5.1/cmp.lua'
        no file '/nix/store/vmln39q308xpq0awd1b5j84i8l58l857-luajit-2.1.0-2022-04-05-env/share/lua/5.1/cmp/init.lua'
        no file '/nix/store/vmln39q308xpq0awd1b5j84i8l58l857-luajit-2.1.0-2022-04-05-env/lib/lua/5.1/cmp.so'
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:20: in main chunk

I also noticed that the config file is no longer saved in the $HOME/.config/ directory, why is that?

Anyway, I will continue using an older version until we can fix some of these issues.

@pta2002
Copy link
Collaborator

pta2002 commented Sep 28, 2022

This is definitely due to the update to support standalone usage. Could you please show your config so I can look into it?

@gingkapls
Copy link

gingkapls commented Sep 28, 2022

Can confirm, my config broke as well. Options are working, but everything else including plugins and vi/vim alias stopped working.

Here's my config for reference

{ config, pkgs, nixvim, ... }:

{
  # Neovim

  programs.nixvim = {
    enable = true;

    plugins = {

      nix.enable = true;
      nvim-autopairs.enable = true;

      lualine = {
        enable = true;

        sectionSeparators = {
          left = "" ;
          right = "" ;
        };

        componentSeparators = {
          left = "" ;
          right = "" ;
        };

        theme = "auto";
      };

      goyo = {
        enable = true;
        showLineNumbers = false;
      };

      lsp = {
        enable = true;
	      servers = {
	        rust-analyzer.enable = true;
	        rnix-lsp.enable = true;
	      };
      };

    };

    options = {
      # Indentation
      autoindent = true;
      tabstop = 4;
      shiftwidth = 4;
      expandtab = true;
      backspace = "indent,eol,start";

      # Text
      showmatch = true;
      mouse = "a";
      number = true;
      relativenumber = false;
      ttyfast = true;
      clipboard = "unnamedplus";

      # Colors
      background = "dark";
      termguicolors = true;

    };

  };

  programs.neovim.vimAlias = true;
  programs.neovim.viAlias = true;

}

@pta2002
Copy link
Collaborator

pta2002 commented Sep 28, 2022

Alright, this is because I stopped using home-manager for managing plugins (maybe deleting ~/.local/share/neovim will fix it). Though looking at this, I should probably go back to using it considering stuff like programs.neovim.vimAlias.

@gingkapls
Copy link

(maybe deleting ~/.local/share/neovim will fix it).

I don't have a ~/.local/share/neovim folder on my system, so I guess it would not solve the issue.

@pta2002
Copy link
Collaborator

pta2002 commented Sep 28, 2022

(maybe deleting ~/.local/share/neovim will fix it).

I don't have a ~/.local/share/neovim folder on my system, so I guess it would not solve the issue.

Sorry, I mistyped it 😅 should be on ~/.local/share/nvim.

@pta2002 pta2002 added the bug Something isn't working label Sep 28, 2022
@gingkapls
Copy link

Sorry, I mistyped it sweat_smile should be on ~/.local/share/nvim.

Oh its okay, I deleted that folder and tried again but the result was same.
By the way, this is the error that pops up whenever I start neovim.

Error detected while processing /nix/store/1mkybnq10kfwmcp708nfrd1gi39ab7k8-init.vim:
line   53:
E5108: Error executing lua [string ":lua"]:20: module 'nvim-autopairs' not found:
        no field package.preload['nvim-autopairs']
        no file '/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/share/lua/5.1/nvim-autopairs.lua'
        no file '/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/share/lua/5.1/nvim-autopairs/init.lua'
        no file '/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/lib/lua/5.1/nvim-autopairs.so'
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:20: in main chunk

The lua/5.1 folder in nix-store only has the jit folder

@pta2002
Copy link
Collaborator

pta2002 commented Sep 29, 2022

Thanks, I'll look into it!

@pta2002
Copy link
Collaborator

pta2002 commented Oct 3, 2022

I am very confused, as this seems to be working for me... Can you share the output of cat $(which nvim)?

@gingkapls
Copy link

Sure, here.

cat $(which nvim)
#! /nix/store/9zm6br2ri10a0b71dll2wrim5bnhg6b6-bash-5.1-p16/bin/bash -e
export NVIM_SYSTEM_RPLUGIN_MANIFEST='/nix/store/b37mm655v10n8ln8bgb6r7hrw6kqr9wf-neovim-0.7.0/rplugin.vim'
export GEM_HOME='/nix/store/8qjl87a5wfjywkl0y6329bfvvjn130ax-neovim-ruby-env/lib/ruby/gems/2.7.0'
PATH=${PATH:+':'$PATH':'}
if [[ $PATH != *':''/nix/store/8qjl87a5wfjywkl0y6329bfvvjn130ax-neovim-ruby-env/bin'':'* ]]; then
    PATH=$PATH'/nix/store/8qjl87a5wfjywkl0y6329bfvvjn130ax-neovim-ruby-env/bin'
fi
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
LUA_PATH=${LUA_PATH:+';'$LUA_PATH';'}
LUA_PATH=${LUA_PATH/';''/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/share/lua/5.1/?/init.lua'';'/';'}
LUA_PATH='/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/share/lua/5.1/?/init.lua'$LUA_PATH
LUA_PATH=${LUA_PATH#';'}
LUA_PATH=${LUA_PATH%';'}
export LUA_PATH
LUA_PATH=${LUA_PATH:+';'$LUA_PATH';'}
LUA_PATH=${LUA_PATH/';''/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/share/lua/5.1/?.lua'';'/';'}
LUA_PATH='/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/share/lua/5.1/?.lua'$LUA_PATH
LUA_PATH=${LUA_PATH#';'}
LUA_PATH=${LUA_PATH%';'}
export LUA_PATH
LUA_CPATH=${LUA_CPATH:+';'$LUA_CPATH';'}
LUA_CPATH=${LUA_CPATH/';''/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/lib/lua/5.1/?.so'';'/';'}
LUA_CPATH='/nix/store/yhwsx7yp5kzm2by5bqz56r393iy7v1js-luajit-2.1.0-2022-04-05-env/lib/lua/5.1/?.so'$LUA_CPATH
LUA_CPATH=${LUA_CPATH#';'}
LUA_CPATH=${LUA_CPATH%';'}
export LUA_CPATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/bj64a4vhys78vy4s4zd9z3jkhsnsl2z6-rnix-lsp-0.2.5/bin'':'/':'}
PATH='/nix/store/bj64a4vhys78vy4s4zd9z3jkhsnsl2z6-rnix-lsp-0.2.5/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
PATH=${PATH:+':'$PATH':'}
PATH=${PATH/':''/nix/store/wi4lmd8vi0p0f15kkh1pfdl5piwkkscz-rust-analyzer-2022-05-17/bin'':'/':'}
PATH='/nix/store/wi4lmd8vi0p0f15kkh1pfdl5piwkkscz-rust-analyzer-2022-05-17/bin'$PATH
PATH=${PATH#':'}
PATH=${PATH%':'}
export PATH
exec -a "$0" "/nix/store/j9lb8ywy1birhlq22z2qdd0x40j80syf-neovim-unwrapped-0.7.0/bin/nvim"  -u /nix/store/k1qbqplgqlrja3c4a7x8n9wpql7s6jcl-init.vim '--cmd' 'let g:loaded_node_provider=0' '--cmd' 'let g:loaded_python_provider=0' '--cmd' 'let g:python3_host_prog='\''/nix/store/b37mm655v10n8ln8bgb6r7hrw6kqr9wf-neovim-0.7.0/bin/nvim-python3'\''' '--cmd' 'let g:ruby_host_prog='\''/nix/store/b37mm655v10n8ln8bgb6r7hrw6kqr9wf-neovim-0.7.0/bin/nvim-ruby'\''' "$@"

@pta2002
Copy link
Collaborator

pta2002 commented Oct 4, 2022

What about the contents of /nix/store/k1qbqplgqlrja3c4a7x8n9wpql7s6jcl-init.vim? Something odd's going on here, because it doesn't seem to be setting the runtimepath of nvim. Here's what the last line of my wrapper script looks like, notice the last arguments:

exec -a "$0" "/nix/store/8svf52rgypxxjcwq5l1sjcykmibb7a61-neovim-unwrapped-0.7.2/bin/nvim"  -u /nix/store/nba1a1lb19kxzznsbcndzbhcvhll5d4k-init.vim '--cmd' 'let g:loaded_node_provider=0 | let g:loaded_python_provider=0 | let g:python3_host_prog='\''/nix/store/bmap065nim5wh6c37ha9ilgm423db3zq-neovim-0.7.2/bin/nvim-python3'\'' | let g:ruby_host_prog='\''/nix/store/bmap065nim5wh6c37ha9ilgm423db3zq-neovim-0.7.2/bin/nvim-ruby'\''' '--cmd' 'set packpath^=/nix/store/nv8nx8acslxa60fizafdpbzcylbpigsf-vim-pack-dir' '--cmd' 'set rtp^=/nix/store/nv8nx8acslxa60fizafdpbzcylbpigsf-vim-pack-dir' "$@"

What version of nixpkgs are you using?

@gingkapls
Copy link

Here it is

" configuration generated by NIX
set nocompatible

colorscheme base16-rose-pine-dawn
lua <<EOF
-- Set up globals {{{
do
  local nixvim_globals = {['goyo_linenr'] = 0}

  for k,v in pairs(nixvim_globals) do
    vim.g[k] = v
  end
end
-- }}}
-- Set up options {{{
do
  local nixvim_options = {['autoindent'] = true,['background'] = 'light',['backspace'] = 'indent,eol,start',['clipboard'] = 'unnamedplus',['expandtab'] = true,['mouse'] = 'a',['number'] = true,['relativenumber'] = false,['shiftwidth'] = 4,['showmatch'] = true,['tabstop'] = 4,['termguicolors'] = true,['ttyfast'] = true}

  for k,v in pairs(nixvim_options) do
    vim.o[k] = v
  end
end
-- }}}

require('nvim-autopairs').setup({})

require("lualine").setup({['options'] = {['component_separators'] = {['left'] = '',['right'] = ''},['section_separators'] = {['left'] = '',['right'] = ''},['theme'] = 'auto'}})
-- LSP {{{
do
  
  local __lspServers = {'rust_analyzer','rnix'}
  local __lspOnAttach = function(client)
    
  end

  local __setup = {
            on_attach = __lspOnAttach
          }

  for i,server in ipairs(__lspServers) do
    if type(server) == "string" then
      require('lspconfig')[server].setup(__setup)
    else
      local options = server.extraOptions
      require('lspconfig')[server.name].setup(options)
    end
  end
end
-- }}}



EOF

My nixpkgs is set to nixos-22.05, although I tried nixos-unstable a few days back and had the same issue if I remember correctly.

@gingkapls
Copy link

Okay, I created a copy of my wrapper script, and added --cmd 'set packpath^=/nix/store/am8i27dgn79jv6r4q7a4ypfhcnbxgird-vim-pack-dir' '--cmd' 'set rtp^=/nix/store/am8i27dgn79jv6r4q7a4ypfhcnbxgird-vim-pack-dir' "$@" manually to the end of it after finding the path of vim-pack-dir in my nix-store.

It fixed it! Is there any reason why it did not set up the packpath in my wrapper script?

@pta2002
Copy link
Collaborator

pta2002 commented Oct 4, 2022

This is probably something to do with the nixos version, I've only tested this in unstable... I'll look into it on nixos-22.05, thanks for clarifying.

@pta2002
Copy link
Collaborator

pta2002 commented Oct 4, 2022

Can confirm this is an issue on nixos-22.05 but not on nixos-unstable

@pta2002 pta2002 changed the title Broken config after update Broken config on nixos-stable Oct 4, 2022
@dwarfmaster
Copy link
Contributor

dwarfmaster commented Oct 6, 2022

I had the same problem, so I vimdiff'd the generated init.vim after and before the refactor, and the only difference is that now colorscheme ... is added to init.vim before the lua part, including before require calls that setup the theme, while before the refactor it was at the end with a vim.cmd([[colorscheme ...]]). That may be the problem, but it wouldn't explain why it works on unstable.

EDIT: indeed moving the colorscheme part to the end only solve the E185: Cannot find color scheme 'nord' part of the error, and not the following ones.

@pta2002
Copy link
Collaborator

pta2002 commented Oct 7, 2022

Fixed by #44!

@Alexnortung
Copy link
Contributor Author

Thanks for the good work guys! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants