[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help wanted: search paths for Erlang and Elixir
From: |
Ivan Sokolov |
Subject: |
Help wanted: search paths for Erlang and Elixir |
Date: |
Sun, 09 Apr 2023 04:08:28 +0300 |
Hello, Guixers!
Erlang/OTP has notion of applications [1], they are usually installed in
$PREFIX/lib/erlang/lib in the form of directories named APP-VERSION,
e.g. asn1-5.0.19.
In order for the Erlang runtime to find the installed application it
must appear in the load path. If there is ERL_ROOTDIR in the
environment, erl(1) will search for application directories in
$ERL_ROOTDIR/lib and will add them to the load path. ([2] mentions
$OTPROOT but it's probably an error in the documentation.) The
following will do for Erlang:
(search-path-specification
(variable "ERL_ROOTDIR")
(files '("lib/erlang"))
(separator #f))
However, Elixir usually installs its applications in
$PREFIX/lib/elixir/lib, and $ERL_ROOTDIR cannot contain a list. Thus,
the environment variable ERL_LIBS [2] seems to be the most fitting way
to compose the load path for our purpose.
Is there a way to write a search-path-specification that will only yield
application directories? I could not write such. Listing
$PREFIX/lib/erlang/lib recursively is a bad option, because OTP
application can contain arbitrary resources. And it will probably slow
down modules resolution.
Thanks in advance!
[1]: https://www.erlang.org/doc/man/application.html
[2]: https://www.erlang.org/doc/man/code.html#code-path
- Help wanted: search paths for Erlang and Elixir,
Ivan Sokolov <=