Carrot
1
I want to connect with a progress openedge database using elixir:
- elixir with odbc enabled
- openedge driver
I’m already stuck at the first step
I was able to get the correct erlang package
erlang_odbc = pkgs.beam.interpreters.erlang_27.override { odbcSupport = true; };
but how can I use erlang with odbc in elixir?
elixir = pkgs.beam.packages.erlang_27.elixir_1_17;
elixir_odbc = ?
doesntwork = (pkgs.beam.interpreters.erlang_27.override { odbcSupport = true; }).elixir_1_17
I think something like this will work
{ pkgs ? import <nixpkgs> {} }:
let
# Define Erlang with ODBC support
erlang_odbc = pkgs.beam.interpreters.erlang_27.override {
odbcSupport = true;
};
# Create a custom beam package set using our ODBC-enabled Erlang
beam_packages = pkgs.beam.packagesWith erlang_odbc;
# Now we can create Elixir using our custom beam packages
elixir_odbc = beam_packages.elixir_1_17;
in
pkgs.mkShell {
buildInputs = [
erlang_odbc
elixir_odbc
pkgs.unixODBC
];
shellHook = ''
export ERL_LIBS="${erlang_odbc}/lib/erlang/lib"
'';
}
save as shell.nix
to test
run nix-shell
and then once it finishes building
iex
Erlang/OTP 27 [erts-15.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Interactive Elixir (1.17.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :odbc.start()
:ok
1 Like
caveat: when I am trying the above expression on macos, it needs to build erlang from source just fyi