Skip to content

Commit

Permalink
fix(?): use nix to install lua and lua-language-server
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jan 18, 2023
1 parent 5ea936e commit 10a4422
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
31 changes: 2 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
# TODO: Use official alpine image with pinned package versions when lua-language-server is available
FROM lspcontainers/lua-language-server:latest AS lua
FROM nixos/nix:2.13.1 AS sumneko-lint

ENV LUA_VERSION="5.1.5"
ENV LUA_SHA1_CHECKSUM="b3882111ad02ecc6b972f8c1241647905cb2e3fc"

RUN set -ex \
&& cat /etc/*-release \
&& apk upgrade \
&& apk add --no-cache readline-dev \
&& apk add --no-cache --virtual .build-deps \
make \
gcc \
libc-dev \
ncurses-dev \
&& wget -cq https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz \
-O lua.tar.gz \
&& [ "$(sha1sum lua.tar.gz | cut -d' ' -f1)" = "${LUA_SHA1_CHECKSUM}" ] \
&& tar -xzf lua.tar.gz \
&& rm lua.tar.gz

WORKDIR /lua-${LUA_VERSION}
RUN make -j"$(nproc)" linux \
&& make install

WORKDIR /
RUN rm -rf lua-${LUA_VERSION} \
&& apk del .build-deps \
&& rm -rf /var/cache/apk/*

FROM lua AS sumneko-lint
RUN nix-env -iA nixpkgs.lua5_1 nixpkgs.sumneko-lua-language-server

COPY lua/entrypoint.lua /entrypoint.lua

Expand Down
1 change: 0 additions & 1 deletion lua/entrypoint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ local function lint(directory)
local redirect = ' >' .. stdout_file .. ' 2>' .. stderr_file
print(cmd)
local exit_code = os.execute(cmd .. redirect)
os.execute('lua-language-server --version > stdout.txt')
local stdout = read_file(stderr_file) or ''
print(stdout)
if exit_code ~= 0 then
Expand Down

0 comments on commit 10a4422

Please sign in to comment.