Compare commits

...

5 Commits

Author SHA1 Message Date
a8bf7698f0 chore: move frequently updated layers to the end 2023-12-08 11:57:20 +00:00
faedb2d4e0 chore: git config is the last step of image 2023-12-08 11:57:20 +00:00
76096daef3 feat: add jetporch to provision machines 2023-12-08 11:57:18 +00:00
Joao P Dubas
3c60715310 wip: add rust toolchain 2023-12-08 11:55:40 +00:00
9cee421a21 chore(elixir): add elixir lsp for version 1.12 (#19)
Explicitly add an elixir lsp suitable to elixir version 1.12.

Reviewed-on: #19
2023-12-08 11:53:14 +00:00
2 changed files with 53 additions and 41 deletions

View File

@ -130,24 +130,19 @@ ENV XDG_CONFIG_HOME ${HOME}/.config
ENV XDG_DATA_HOME ${HOME}/.local/share ENV XDG_DATA_HOME ${HOME}/.local/share
ENV XDG_CACHE_HOME ${HOME}/.cache ENV XDG_CACHE_HOME ${HOME}/.cache
ENV STARSHIP_CONFIG ${XDG_CONFIG_HOME}/starship/config.toml ENV STARSHIP_CONFIG ${XDG_CONFIG_HOME}/starship/config.toml
ENV PATH ${LOCAL_BIN_HOME}:$PATH ENV CARGO_HOME ${XDG_DATA_HOME}/cargo
# NOTE (jpd): to install elixirls we have to set the shell to something known ENV RUSTUP_HOME ${XDG_DATA_HOME}/rustup
ENV SHELL /usr/bin/bash ENV PATH ${LOCAL_BIN_HOME}:${CARGO_HOME}/bin:$PATH
# command line utilities # command line utilities
RUN curl https://rtx.pub/install.sh | sh \ RUN curl https://rtx.pub/install.sh | sh \
&& curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash \ && curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash \
&& git clone https://github.com/tmux-plugins/tpm.git ${XDG_CONFIG_HOME}/tmux/plugins/tpm && git clone https://github.com/tmux-plugins/tpm.git ${XDG_CONFIG_HOME}/tmux/plugins/tpm \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
# git configuration && git clone https://git.sr.ht/~mpdehaan/jetporch ${LOCAL_SRC_HOME}/jetporch \
COPY ./patch/kickstart.nvim/updates.patch /tmp && cd ${LOCAL_SRC_HOME}/jetporch \
COPY ./config/nvim/lua/custom/plugins/init.lua /tmp && make \
RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \ && ln -s ${LOCAL_SRC_HOME}/jetporch/target/release/jetp ${LOCAL_BIN_HOME}/
&& cd ${XDG_CONFIG_HOME}/nvim \
&& git reset --hard 1915cea32e13fcb4191904de8f5e0252ad050a6e \
&& git apply /tmp/updates.patch \
&& cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \
&& nvim --headless "+Lazy! sync" +qa
# configure fish and bash # configure fish and bash
RUN fish -c true \ RUN fish -c true \
@ -159,25 +154,6 @@ RUN fish -c true \
&& echo 'alias ll="l -Fahl"' >> ${XDG_CONFIG_HOME}/fish/config.fish \ && echo 'alias ll="l -Fahl"' >> ${XDG_CONFIG_HOME}/fish/config.fish \
&& echo 'alias la="l -a"' >> ${XDG_CONFIG_HOME}/fish/config.fish && echo 'alias la="l -a"' >> ${XDG_CONFIG_HOME}/fish/config.fish
# configure git
ARG GIT_USER_EMAIL
ARG GIT_USER_NAME
RUN git config --global user.email "${GIT_USER_EMAIL}" \
&& git config --global user.name "${GIT_USER_NAME}" \
&& git config --global core.editor nvim
# install rtx plugins
RUN ${XDG_DATA_HOME}/rtx/bin/rtx plugins install \
awscli \
elixir \
erlang \
helm \
kubectl \
lefthook \
poetry \
terraform \
tilt
# NOTE (jpd): the section below exists mainly to handle a project running elixir 1.11. # NOTE (jpd): the section below exists mainly to handle a project running elixir 1.11.
# It allows the usage of openssl 1.1 and a compatible elixir-ls. # It allows the usage of openssl 1.1 and a compatible elixir-ls.
@ -194,13 +170,46 @@ RUN mkdir -p ${HOME}/.local/src \
# && make test \ # && make test \
&& make install && make install
# fetch elixir-ls compatible with elixir 1.11.x # fetch elixir-ls compatible with elixir 1.11.x and 1.12.x
# to setup this project run the following commands: # to setup this project run the following commands:
# mix do local.rebar --force, local.hex --force # mix do local.rebar --force, local.hex --force
# mix do deps.get, deps.compile # mix do deps.get, deps.compile
# MIX_ENV=prod mix compile # MIX_ENV=prod mix compile
# MIX_ENV=prod mix elixir_ls.release # MIX_ENV=prod mix elixir_ls.release
RUN git clone https://github.com/elixir-lsp/elixir-ls.git ${LOCAL_SRC_HOME}/elixir-ls \ RUN git clone https://github.com/elixir-lsp/elixir-ls.git ${LOCAL_SRC_HOME}/elixir-ls/v0.12.0 \
&& cd ${LOCAL_SRC_HOME}/elixir-ls \ && cd ${LOCAL_SRC_HOME}/elixir-ls/v0.12.0 \
&& git checkout tags/v0.12.0 \ && git checkout tags/v0.12.0 \
&& cp .release-tool-versions .tool-versions \
&& git clone https://github.com/elixir-lsp/elixir-ls.git ${LOCAL_SRC_HOME}/elixir-ls/v0.14.6 \
&& cd ${LOCAL_SRC_HOME}/elixir-ls/v0.14.6 \
&& git checkout tags/v0.14.6 \
&& cp .release-tool-versions .tool-versions && cp .release-tool-versions .tool-versions
# git configuration
COPY ./patch/kickstart.nvim/updates.patch /tmp
COPY ./config/nvim/lua/custom/plugins/init.lua /tmp
RUN git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME}"/nvim \
&& cd ${XDG_CONFIG_HOME}/nvim \
&& git reset --hard 1915cea32e13fcb4191904de8f5e0252ad050a6e \
&& git apply /tmp/updates.patch \
&& cp /tmp/init.lua ${XDG_CONFIG_HOME}/nvim/lua/custom/plugins \
&& nvim --headless "+Lazy! sync" +qa
# install rtx plugins
RUN ${XDG_DATA_HOME}/rtx/bin/rtx plugins install \
awscli \
elixir \
erlang \
helm \
kubectl \
lefthook \
poetry \
terraform \
tilt
# configure git
ARG GIT_USER_EMAIL
ARG GIT_USER_NAME
RUN git config --global user.email "${GIT_USER_EMAIL}" \
&& git config --global user.name "${GIT_USER_NAME}" \
&& git config --global core.editor nvim

View File

@ -1,5 +1,5 @@
diff --git a/init.lua b/init.lua diff --git a/init.lua b/init.lua
index 3a98da0..e8e41b4 100644 index 3a98da0..e8c5b7d 100644
--- a/init.lua --- a/init.lua
+++ b/init.lua +++ b/init.lua
@@ -229,7 +229,7 @@ require('lazy').setup({ @@ -229,7 +229,7 @@ require('lazy').setup({
@ -111,7 +111,7 @@ index 3a98da0..e8e41b4 100644
} }
-- Setup neovim lua configuration -- Setup neovim lua configuration
@@ -542,12 +578,20 @@ mason_lspconfig.setup { @@ -542,12 +578,23 @@ mason_lspconfig.setup {
mason_lspconfig.setup_handlers { mason_lspconfig.setup_handlers {
function(server_name) function(server_name)
@ -124,9 +124,12 @@ index 3a98da0..e8e41b4 100644
} }
+ if server_name == 'elixirls' then + if server_name == 'elixirls' then
+ local version = vim.fn.system('rtx current elixir') or '' + local version = vim.fn.system('rtx current elixir') or ''
+ local match_version = string.match(version, '^1.11') + local match_version_111 = string.match(version, '^1.11')
+ if match_version ~= nil then + local match_version_112 = string.match(version, '^1.12')
+ opts = vim.tbl_extend('keep', opts, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. '/elixir-ls/release/language_server.sh' } }) + if match_version_111 ~= nil then
+ opts = vim.tbl_extend('keep', opts, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. '/elixir-ls/v0.12.0/release/language_server.sh' } })
+ elseif match_version_112 ~= nil then
+ opts = vim.tbl_extend('keep', opts, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. '/elixir-ls/v0.14.6/release/language_server.sh' } })
+ end + end
+ end + end
+ require('lspconfig')[server_name].setup(opts) + require('lspconfig')[server_name].setup(opts)