NicoElbers / nv

A patcher that takes in a regular lua neovim config and makes it nix compatible
MIT License
43 stars 1 forks source link

Cryptic error message when there are two plugins with the same name #8

Closed nvimtor closed 3 weeks ago

nvimtor commented 3 weeks ago

FYI I got this

Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/r1s6jgjm2swvzwhjy5k4bycyvimdvi19-nvim
source root is nvim
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
debug: Attempting to open file '/nix/store/5w3dp0m37794iffsbm9vd9f1xmmhda6i-source/pkgs/applications/editors/vim/plugins/generated.nix'
debug: Attempting to open file '/nix/store/5w3dp0m37794iffsbm9vd9f1xmmhda6i-source/pkgs/development/lua-modules/generated-packages.nix'
debug: Found 22 plugins
debug: Found 19 relevant urls
debug: Found 1 relevant urls
warning: Did not find a url for nvim-cmp
warning: Did not find a url for cmp-nvim-lsp
thread 2440816 panic: reached unreachable code
???:?:?: 0x102c7f0fb in _debug.assert (???)
???:?:?: 0x102c8382f in _InputParser.parseInput (???)
???:?:?: 0x102c83e83 in _main.getPlugins (???)
???:?:?: 0x102c8cb23 in _main.main (???)
???:?:?: 0x102c8dacb in _main (???)
???:?:?: 0x188c560df in ??? (???)
???:?:?: 0x9e6bffffffffffff in ??? (???)
/nix/store/r34vx55ixx810pzl3fhcnanzcxdr6xys-stdenv-darwin/setup: line 1743: 58963 Abort trap: 6           /nix/store/cl4c8imrn9vakq1y3jmkv2qnx98xfr2a-conf>
vim.g.loaded_node_provider=0
vim.g.loaded_perl_provider=0
vim.g.loaded_python_provider=0
vim.g.loaded_python3_provider=0
vim.g.loaded_ruby_provider=0
vim.g.nix = true
vim.g.configdir = vim.fn.stdpath('\''config'\'')
vim.opt.packpath:remove(vim.g.configdir)
vim.opt.runtimepath:remove(vim.g.configdir)
vim.opt.runtimepath:remove(vim.g.configdir .. "/after")
vim.g.configdir = [[/nix/store/0xxqh9m91rwvr3nzgpwb7095vw8jbqwj-nvim-config-patched]]
vim.opt.packpath:prepend(vim.g.configdir)
vim.opt.runtimepath:prepend(vim.g.configdir)
vim.opt.runtimepath:append(vim.g.configdir .. "/after")

-- Extra config provided by user
-- Lua config

'

when I accidentally left two same plugins in the flake

It seems the error has thrown in https://github.com/NicoElbers/nv/blob/0331a51e9c124f6c6dc1fc3b67d3c015aae25b8d/patcher/src/parsers/InputParser.zig#L31C1-L42C6

I'm not familiar with Zig but would it be possible to add an error message? and just out of curiosity (again :D), is there a reason to do an assert instead of say, pick the last one with the same name?

thanks

NicoElbers commented 3 weeks ago

Good point, I should probably change this to an error message, since this is something that could be triggered by a user. Assert was easiest at the time. Should be fixed soon