mason.nvim icon indicating copy to clipboard operation
mason.nvim copied to clipboard

Package lua-language-server does not work on NIXOS

Open rickswe opened this issue 1 year ago • 3 comments

I've searched open issues for similar requests

  • [X] Yes

I've manually reviewed logs to find potential errors

  • [X] Yes

I've recently downloaded the latest plugin version of mason.nvim

  • [X] Yes

Problem description

The package provided by Mason lua-language-server does not work with NIXOS. However, the package provided by NIXOS does work with NIXOS. How is this possible? What is changed in the build if anything?

I did read discussions number 839, it seems like a hacky way to do things.

Thanks

Expected behavior

The expected behavior would be to have a package that works out of the box.

Steps to reproduce

Try runing lua-language-server on NIXOS, it will point you to this website: How to run non-nix executables

Affected packages

lua-language-server

Neovim version (>= 0.7)

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1693350652

Operating system/version

Linux nixos 6.6.24 1-NixOS SMP PREEMPT_DYNAMIC Wed Apr 3 13:29:04 UTC 2024 x86_64 GNU/Linux

Healthcheck

mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-04-09-lying-lotus` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.21.4 built on linux-gnu.`
- OK curl: `curl 8.6.0 (x86_64-pc-linux-gnu) libcurl/8.6.0 OpenSSL/3.0.13 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.60.0`
- OK gzip: `gzip 1.13`
- OK tar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Ruby: `ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]`
- WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code - and signal -. javac is not executable
- WARNING java: not available
  - ADVICE:
    - spawn: java failed with exit code - and signal -. java is not executable
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- WARNING python: not available
  - ADVICE:
    - spawn: python3 failed with exit code - and signal -. python3 is not executable
- WARNING pip: not available
  - ADVICE:
    - spawn: python3 failed with exit code - and signal -. python3 is not executable
- WARNING python venv: not available
  - ADVICE:
    - On Debian/Ubuntu systems, you need to install the python3-venv package using the following command:
      
      apt-get install python3-venv
- OK Go: `go version go1.22.1 linux/amd64`
- OK node: `v20.11.1`
- OK RubyGem: `3.5.6`
- OK npm: `10.2.4`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 7. Remaining: 53. Limit: 60. Reset: Tue 09 Apr 2024 08:53:26 PM CDT.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

No response

rickswe avatar Apr 10 '24 01:04 rickswe

How is this possible? What is changed in the build if anything?

This is how NixOS works (or doesn't 😄).

Downloading and attempting to run a binary on NixOS will almost never work. This is due to hard-coded paths in the executable. Unfortunately, almost all unfree and proprietary software comes in binary form - the main reason to include binaries is because no source code is available. This tutorial will guide you through packaging a binary executable.

So, I guess lua-language-server installed by Mason is missing some shared libraries, which of course are known by the NixOS package.

I made a blog post on this topic and one approach to solve this. It is labor intense and hacky but works (until a package is updated 😄 ).

Allaman avatar May 05 '24 15:05 Allaman

@Allaman I ended up creating a symbolic link which is a temporary simple solution. This is probably not even needed since it's already installed system wide. I'm not sure I have not been on neovim in a while.

cd ~/.local/share/nvim-lazyvim/mason/bin
ln -sf $(which lua-language-server) lua-language-server

rickswe avatar May 05 '24 15:05 rickswe

Same thing happens with the following:

  • stylua

rickswe avatar May 22 '24 01:05 rickswe