Open erkkimon opened 11 months ago
Just as an update, I talked with NixOS guys and the optimal NixOS way to do this would be building the server on NixOS and providing that endpoint to the extension.
So the steps would be the following:
I will try to do this but if someone else accomplishes some of these steps, please share your results so we can play this game together!
Check out how rust-analyzer solved this: https://github.com/rust-lang/rust-analyzer/blob/3b1b58c225d35414d90078dc7e06ca74a49cad0c/editors/code/src/bootstrap.ts.
If you think building a NixOS binary is the way to go, I'd add a step in the release CI to build it.
Thanks for digging into this!
Thanks @McPatate!
I managed to create a working derivation and at the moment I'm using llm-ls with llm-vscode on VSCodium running on NixOS. I have never submitted a derivation to nixpkgs but it will be my next battle to figure it out. I guess I'm already quite close.
Anyway, with this derivation it is possible to use llm-ls + VSCodium on NixOS with no problems before it will be available at nixpkgs. The derivation file (default.nix) looks like following:
{ pkgs ? import <nixpkgs> {} }:
let
src = pkgs.fetchFromGitHub {
owner = "huggingface";
repo = "llm-ls";
rev = "v0.2.1";
sha256 = "1ja641l1sqzv3dczsf9ra99f3kz3cs07ha3m6vs9pj66x1lpbbvj";
};
in
pkgs.rustPlatform.buildRustPackage rec {
pname = "llm-ls";
version = "0.2.1";
inherit src;
buildPhase = "cargo build --release";
installPhase = ''
mkdir -p $out/bin
cp target/release/llm-ls $out/bin/llm-ls
'';
meta = {
description = "llm-ls is a LSP server leveraging LLMs for code completion";
homepage = "https://github.com/huggingface/llm-ls";
license = pkgs.lib.licenses.asl20;
maintainers = with pkgs.lib.maintainers; [ erkkimon ];
};
cargoSha256 = "JGCD8CXxbWwygVfpohM9yyFP/KGN604I4bSayg/gQzM=";
}
Building and usage:
nix-build
."llm.lsp.binaryPath": "/home/user/herpderp/llm-ls/result/bin/llm-ls"
to the root level of the settings object.NB! You can also add the llm-ls binary path through llm-vscode extension settings which will take you to the same settings JSON creating the right key with empty value, which you should replace with the path of the binary you just built using the derivation.
The plugin v0.1.0 installs fine on NixOS (23.05) and VSCodium v1.82.2.23257 but crashes on launch. This is the error that I get:
Trying to run the server from terminal results error "No such file or directory", and the problem doesn't seem to be in execution rights:
Any ideas? If I figure out something, I will definitely let the internet know.