{ lib, stdenv, fetchFromGitHub, # nativeBuildInputs ninja, makeWrapper, # buildInputs fmt, libbfd, libunwind, rsync, versionCheckHook, nix-update-script, runCommand, lua-language-server, }: stdenv.mkDerivation (finalAttrs: { pname = "lua-language-server"; version = "3.18.2"; src = fetchFromGitHub { owner = "luals"; repo = "lua-language-server"; tag = finalAttrs.version; hash = "sha256-c8YxTNmvloN9oabdbl5ZKgXqhxeZ9eVBt3B0Q9wA/GQ="; fetchSubmodules = true; }; nativeBuildInputs = [ ninja makeWrapper ]; buildInputs = [ fmt libbfd libunwind ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ rsync ]; env.NIX_LDFLAGS = "-lfmt"; postPatch = '' # filewatch tests are failing on darwin # this feature is not used in lua-language-server substituteInPlace 3rd/bee.lua/test/test.lua \ --replace-fail 'require "test_filewatch"' "" # use nixpkgs fmt library for d in 3rd/bee.lua 3rd/luamake/bee.lua do rm -r $d/3rd/fmt/* touch $d/3rd/fmt/format.cc substituteInPlace $d/bee/nonstd/format.h $d/bee/nonstd/print.h \ --replace-fail "include <3rd/fmt/fmt" "include &1 | head -c 1000 ) || true echo "$RESPONSE" | grep -q '"capabilities"' touch $out ''; }; meta = { description = "Language server that offers Lua language support"; homepage = "https://github.com/luals/lua-language-server"; changelog = "https://github.com/LuaLS/lua-language-server/blob/${finalAttrs.version}/changelog.md"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ gepbird yvnth ]; mainProgram = "lua-language-server"; platforms = lib.platforms.linux ++ lib.platforms.darwin; }; })