Nextjournal / Dec 16 2019
Elixir Environment
This notebook creates the default Elixir environment in Nextjournal.
Setup
Build Environment
Add erlang repo.
REPO_VER="2.0"
file="erlang-solutions_${REPO_VER}_all.deb"
wget --progress=bar:force https://packages.erlang-solutions.com/${file}
dpkg -i $file
rm $file
2.0s
Elixir (Bash)
Install build tools and dependencies.
apt-get -qq update
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends \
libsqlite3-dev libncurses5-dev libncursesw5-dev \
libblas-dev liblapack-dev libatlas-base-dev \
libxslt1-dev unixodbc-dev libsctp-dev libwxgtk3.0-dev \
esl-erlang elixir
apt-get clean
rm -r /var/lib/apt/lists/* # Clear package list so it isn't stale
57.6s
Elixir (Bash)
Grab IElixir source.
git clone https://github.com/pprzetacznik/IElixir.git
2.1s
Elixir (Bash)
Install and compile deps, then compile IElixir.
cd IElixir
mix local.hex --force
mix local.rebar --force
mix deps.get
mix deps.compile
mix test
MIX_ENV=prod mix compile
235.2s
Elixir (Bash)
Install the kernel.
ln -sf /usr/bin/python3 /root/.mix/python # kludge
cd IElixir
./install_script.sh
4.0s
Elixir (Bash)
Check.
du -hsx /
elixir --version
jupyter kernelspec list
3.3s
Elixir (Bash)
Testing
send self(), {:elixir, "Rocks!"}
receive do
{:elixir, msg} -> ["Elixir", msg]
after
1_000 -> :ok
end
0.5s
Elixir Test (Elixir)
Elixir
["Elixir", "Rocks!"]