Open j-steinbach opened 1 year ago
Thanks for reporting @j-steinbach! I'd imagine the problem might be due to incompatible dynamic dependencies -- the marksman binary is linked statically but it still has some dynamic dependencies (e.g. libc); prebuilt binaries are built on Debian which may use different versions of dynamic libs compared to NixOS.
I'd love to have prebuilt binaries that work on NixOS too, but the PR would have to come from someone who actually knows their way around NixOS.
I think this not only about marksman, as some other LSPs fail the same way(deno, selene, stylua). But others work (shfmt, prettierd). All installed via Mason. This could be a starting point when looking into this.
I am unfortunately a Nix noob, but maybe it is possible to Marksman as build input to the Neovim nixpkg. Might be a workaround. I'll see if I find time to try it this weekend (unlikely).
Small workaround: I changed the cmd
in my mason/lspconfig to cmd = { "/etc/profiles/per-user/jst/bin/marksman", "server" },
, which is the path to my system Marksman install (which marksman
). Not pretty but at least it gets it to work. Old version though.
Highly recommend using the Nix package for Marksman on NixOS. Changing the cmd
to something like { "nix", "run", "nixpkgs#marksman", "--", "server" }
will work.
A more polished config with Nix-provided LSP can be found on my Gitea
While this issue is being dealt with, here's my two cents. I use LazyVim and enabled the markdown extra by adding this line to my nvim/lua/config/lazy.lua
{ import = "lazyvim.plugins.extras.lang.markdown" },
The source code is available here. This automatically configures nvim-lspconfig to use the marksman downloaded by mason which is not what we want. Instead I added this to my plugins to maintain compatibility with anything non-NixOS
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
-- Because the official marksman has dynamic lib issues on NixOS
-- Remember to install marksman manually
marksman = {
cmd = {
"sh",
"-c",
"test -x /run/current-system/sw/bin/marksman && { /run/current-system/sw/bin/marksman server; } || { marksman server; }",
},
},
},
},
},
}
I am definitely doing something wrong, but I don't know where/how.
I installed marksman via LazyVim mason/mason-lspconfig. I tried 'installing' it with just the default config, Folkes dotfiles config, the config mentioned here and the values mentioned in the install readme.
In Nvim I get the error
When I navigate to the folder, I see the binary (and/or the symlinked version). I can change it
chmod +x
and then try to run it, but I getThis happens for 5 random releases I grabbed from the marksman 'releases' page.
But when installing marksman via my package manager (NixOS), I can run it just fine.
The same version from the release page fails again.
I am not sure if this is a
marksman
or amason.nvim
problem or if I am just doing something wrong. But I assumed that when I can't run the pre-compiled binary that I got from the repo, then this is the place to ask.