unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help wanted: search paths for Erlang and Elixir
@ 2023-04-09  1:08 Ivan Sokolov
  2023-04-19 20:28 ` Ivan Sokolov
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Sokolov @ 2023-04-09  1:08 UTC (permalink / raw)
  To: guix-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Help wanted: search paths for Erlang and Elixir
  2023-04-09  1:08 Help wanted: search paths for Erlang and Elixir Ivan Sokolov
@ 2023-04-19 20:28 ` Ivan Sokolov
  0 siblings, 0 replies; 2+ messages in thread
From: Ivan Sokolov @ 2023-04-19 20:28 UTC (permalink / raw)
  To: guix-devel

Ivan Sokolov <ivan-p-sokolov@ya.ru> writes:

> 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.)

It turns out that OTPROOT is not a real variable, but a placeholder for
the Erlang installation directory, and ERL_ROOTDIR is intented for
internal use only.  Thus ERL_LIBS is the only option left.

> [2]: https://www.erlang.org/doc/man/code.html#code-path


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-19 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-09  1:08 Help wanted: search paths for Erlang and Elixir Ivan Sokolov
2023-04-19 20:28 ` Ivan Sokolov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).