My project uses Elixir (which requires Erlang), and this project uses asdf-vm
(or the compatible rtx
) to manage the versions.
Erlang is required to be compiled from source in this setup, which happens through kerl
, and this is where things go slightly wrong.
I am able to compile erlang, but it seems like OpenSSL is not picked up correctly. After compiling the :crypto application can not be started, and everything points to Erlang not being compiled with OpenSSL.
I’m using the shell.nix
to compile it, but honestly I’m just throwing throwing stuff at the wall to see what sticks. Any help is greatly appreciated
Here is my config:
with import <nixpkgs> { };
let
# define packages to install
basePackages = [
git
erlang
elixir
postgresql # make psql and pg_dump available (e.g. to run mix ecto.dump)
### phoenix ###
libnotify
inotify-tools
### build dependencies - rtx ###
autoconf
ncurses
libxslt
fop
wxGTK32
### runtime dependencies - rtx ###
openssl
];
# define shell startup command
hooks = ''
export KERL_BUILD_DOCS=yes
export KERL_INSTALL_HTMLDOCS=no
export KERL_INSTALL_MANPAGES=no
#export KERL_CONFIGURE_OPTIONS="--with-ssl=$(which openssl)"
# this allows mix to work on the local directory
mkdir -p .nix-mix
mkdir -p .nix-hex
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export PATH=$MIX_HOME/bin:$PATH
export PATH=$HEX_HOME/bin:$PATH
export LANG=en_US.UTF-8
export ERL_AFLAGS="-kernel shell_history enabled"
'';
in
mkShell {
buildInputs = basePackages;
shellHook = hooks;
# erlang has hardcoded ssl library locations (std_ssl_locations) https://github.com/erlang/otp/blob/4c49b713ddf1830047c55e8a17e3f2255be73462/lib/crypto/configure.ac#L84
NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
stdenv.cc.cc
openssl.dev
];
NIX_LD = lib.fileContents "${stdenv.cc}/nix-support/dynamic-linker";
}