Skip to content

nextls doesn't start on NixOS #56

Open
@elliottneilclark

Description

@elliottneilclark

On a Linux machine configured with NixOS, dynamic loading is different. Because of this it's often not possible to simply download a binary that depends on libc and run it.

This manifests as vscode not starting the nextls binary

[Error - 11:51:56 AM] NextLS client: couldn't create connection to server.
Launching server using command /home/elliott/.cache/elixir-tools/nextls/bin/nextls failed. Error: spawn /home/elliott/.cache/elixir-tools/nextls/bin/nextls ENOENT

Nix provides a utility to change all the loads in place. That seems to get nextls running

steam-run ./nextls
Next LS v0.12.6

The language server for Elixir that just works.

     Author: Mitchell Hanberg
  Home page: https://www.elixir-tools.dev/next-ls
Source code: https://github.com/elixir-tools/next-ls

nextls [flags]

FLAGS

  --stdio             Use stdio as the transport mechanism
  --port <port>       Use TCP as the transport mechanism, with the given port
  --help              Show help
  --version           Show nextls version

It might be possible to detect that vscode is on Nixos and then run steam-run nextls in the extension.

Rust Analyzer also has a similar issue of needing a running process downloaded from the internet. They chose to solve this by having nixos fix up the binary.

https://github.com/rust-lang/rust-analyzer/blob/2b580a1f3c7bf7f2dd6d1462282362b80a6a3d91/editors/code/src/bootstrap.ts#L100C1-L144C2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions