add haxe-language-server to nvim-tools

This commit is contained in:
LordMZTE 2024-05-07 00:04:29 +02:00
parent fc49a634a8
commit 03e6234736
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
4 changed files with 222 additions and 5 deletions

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1714635257,
"narHash": "sha256-4cPymbty65RvF1DWQfc+Bc8B233A1BWxJnNULJKQ1EY=",
"lastModified": 1714906307,
"narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63c3a29ca82437c87573e4c6919b09a24ea61b0f",
"rev": "25865a40d14b3f9cf19f19b924e2ab4069b09588",
"type": "github"
},
"original": {

View file

@ -8,9 +8,9 @@ let
in
{
imports = [
./nvim-tools
./jvm.nix
./nvim-plugins.nix
./nvim-tools.nix
./tree-sitter-parsers.nix
];

View file

@ -2,7 +2,7 @@
let
flakePkg = ref: (builtins.getFlake ref).packages.${system}.default;
default-packages = with pkgs; [
# MISSING: haxe_language_server, racket_langserver, zls
# MISSING: racket_langserver
# Language Servers
(pkgs.linkFarm "clang-nvim" (map
(bin: { name = "bin/${bin}"; path = "${clang-tools}/bin/${bin}"; })
@ -22,6 +22,7 @@ let
nativeBuildInputs = with pkgs; [ zig_0_12.hook git ];
})
(pkgs.callPackage ./haxe-language-server.nix { })
jdt-language-server
lua-language-server
(flakePkg "github:oxalica/nil")
@ -40,6 +41,7 @@ let
})
taplo
vscode-langservers-extracted # cssls, eslint, html, jsonls
zls
# Formatters
(pkgs.linkFarm "prettier" [{ name = "bin/prettier"; path = "${nodePackages.prettier}/bin/prettier"; }]) # needed due to symlink shenanigans

View file

@ -0,0 +1,215 @@
{ lib, pkgs, stdenvNoCC, ... }:
let
mkHaxelib = { libname, version, src }: stdenvNoCC.mkDerivation {
name = "${libname}-${version}";
inherit src;
installPhase = ''
runHook preInstall
ver="${lib.replaceStrings ["."] [","] version}"
mkdir $out
if [ $(ls $src | wc -l) == 1 ]; then
cp -r $src/* $out/$ver
else
cp -r $src $out/$ver
fi
echo ${version} > $out/.current
runHook postInstall
'';
};
fetchHaxelib = { libname, version, hash ? "" }: mkHaxelib {
inherit libname version;
src = pkgs.fetchzip {
url = "http://lib.haxe.org/files/3.0/${lib.replaceStrings ["."] [","] "${libname}-${version}"}.zip";
stripRoot = false;
inherit hash;
};
};
deps = pkgs.linkFarm "haxelib-deps" [
# Direct deps
{
name = "hxnodejs";
path = mkHaxelib {
libname = "hxnodejs";
version = "git";
src = pkgs.fetchFromGitHub {
owner = "HaxeFoundation";
repo = "hxnodejs";
rev = "504066dc1ba5ad543afa5f6c3ea019f06136a82b";
hash = "sha256-/QTwm7oKdPnTYFMaEZ6q3FwqBBu++rcf0SbaKJ6KjuA=";
};
};
}
{
name = "hxparse";
path = mkHaxelib {
libname = "hxparse";
version = "git";
src = pkgs.fetchFromGitHub {
owner = "simn";
repo = "hxparse";
rev = "876070ec62a4869de60081f87763e23457a3bda8";
hash = "sha256-uIsF0oAXVY+MrJDXlsYobD1pwq3HsTowK6NMMRgD2fg=";
};
};
}
{
name = "haxeparser";
path = mkHaxelib {
libname = "haxeparser";
version = "git";
src = pkgs.fetchFromGitHub {
owner = "HaxeCheckstyle";
repo = "haxeparser";
rev = "7e98c9aef901b8e26541cf3f8a6e1da0385b237a";
hash = "sha256-T61tEtdLBe16+XPXnmxQkoqpZa2FhAohQBMwHkMiFr0=";
};
};
}
{
name = "tokentree";
path = fetchHaxelib {
libname = "tokentree";
version = "1.2.10";
hash = "sha256-f3OpLPDcigsTB7dpwV9PTUBuTxprdc6aEPEc81OfO9o=";
};
}
{
name = "formatter";
path = fetchHaxelib {
libname = "formatter";
version = "1.15.0";
hash = "sha256-cCDuG5YbU+07BrWVJIK1wjsEgvde5lqIOLLZMniTPfc=";
};
}
{
name = "rename";
path = fetchHaxelib {
libname = "rename";
version = "2.2.2";
hash = "sha256-pyQhG+oFeb7XKV1I4CEASedi0NiFZuHV5/OBNLYZRIo=";
};
}
{
name = "json2object";
path = mkHaxelib {
libname = "json2object";
version = "git";
src = pkgs.fetchFromGitHub {
owner = "elnabo";
repo = "json2object";
rev = "429986134031cbb1980f09d0d3d642b4b4cbcd6a";
hash = "sha256-UwPbDL9pICmShhRik3fGCDJrvj0oUuGgVziPMZW4DHY=";
};
};
}
{
name = "language-server-protocol";
path = mkHaxelib {
libname = "language-server-protocol";
version = "git";
src = pkgs.fetchFromGitHub {
owner = "vshaxe";
repo = "language-server-protocol-haxe";
rev = "a6baa2ddcd792e99b19398048ef95aa00f0aa1f6";
hash = "sha256-CAAn6zeR3oV16fPQerZFgZ0dZaZj5MzbHvhtwhEZ0Ro=";
};
};
}
{
name = "vscode-json-rpc";
path = mkHaxelib {
libname = "vscode-json-rpc";
version = "git";
src = pkgs.fetchFromGitHub {
owner = "vshaxe";
repo = "vscode-json-rpc";
rev = "0160f06bc9df1dd0547f2edf23753540db74ed5b";
hash = "sha256-dwd2Ml9kORtkAs0P4B9qC+HTI2JOaLRzxpppeGbnlos=";
};
};
}
{
name = "uglifyjs";
path = fetchHaxelib {
libname = "uglifyjs";
version = "1.0.0";
hash = "sha256-1dR6BzftIXe68U8kFi2A2mssOEcCOkrervmsnxwwpFw=";
};
}
{
name = "safety";
path = fetchHaxelib {
libname = "safety";
version = "1.1.2";
hash = "sha256-fq+W8Or6raW00vsRQ1nbjs4IPou9MV536Yj+uk9VHyU=";
};
}
# Indirect deps
{
name = "hxjsonast";
path = fetchHaxelib {
libname = "hxjsonast";
version = "1.1.0";
hash = "sha256-5Kbq/hDKypx29omnU8bFfd634KqBVYybEmUZh13qjYc=";
};
}
{
name = "test-adapter";
path = fetchHaxelib {
libname = "test-adapter";
version = "2.0.4";
hash = "sha256-OAw/JEL26LZqlY9n2OeeVvp/i4Ts5x3WyoPFYMUBg8k=";
};
}
{
name = "utest";
path = mkHaxelib {
libname = "utest";
version = "git";
src = pkgs.fetchFromGitHub {
owner = "haxe-utest";
repo = "utest";
rev = "a94f8812e8786f2b5fec52ce9f26927591d26327";
hash = "sha256-cf7688QxtuQGHvTsG/eJ2PNOVUrcNG/G5ZaysDH5two=";
};
};
}
];
in
pkgs.stdenvNoCC.mkDerivation {
name = "haxe-language-server";
src = pkgs.fetchFromGitHub {
owner = "klabz";
repo = "haxe-languageserver";
rev = "012951e82f023bc1f662a4b7520c3a39817988ef";
hash = "sha256-rKzyeLbXNBL3wGXYtb3n9YNU0Qwm1Tsl2XPJYXMEjAo=";
};
nativeBuildInputs = with pkgs; [ haxe nodePackages.uglify-js ];
configurePhase = ''
runHook preConfigure
export HOME=/build
echo '${deps}' > /build/.haxelib
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
haxe build.hxml
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
echo '#!${pkgs.nodejs}/bin/node' > $out/bin/haxe-language-server
cat bin/server.js >> $out/bin/haxe-language-server
chmod +x $out/bin/haxe-language-server
runHook postInstall
'';
}