On Thu, 30 Jun 2022 11:00:03 +0200 Hartmut Goebel <h.goe...@crazy-compilers.com> wrote: > The rebar-build-system I created was published just a few weeks ago. > Anyhow, I'm not a Erlang/OTP user, so this build-system might still need > improvement. Any help on this is welcome.
Hi Hartmut, Good News! I found out what environment variable we need to set in order for Guix to find Erlang libraries: It's ERL_LIBS that needs to be set in order for Erlang to find installed libraries in /guix/store/.../lib/erlang/lib/ Here's an example of what Nix does: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/beam-modules/hex/default.nix#L21 I tested this with a guix shell and erlang-jsx: https://issues.guix.gnu.org/58458 All I did was enter an erlang repl (erl) and run the following code: λ guix shell -D guix --pure hint: Consider passing the `--check' option once to make sure your shell does not clobber environment variables. guix-shell ./pre-inst-env guix shell erlang erlang-jsx --search-paths --pure ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/python.scm ;;; newer than compiled /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/python.go ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/python.scm ;;; newer than compiled /home/jgart/.guix-profile/lib/guile/3.0/site-ccache/gnu/packages/python.go ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/erlang.scm ;;; newer than compiled /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/erlang.go ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/erlang.scm ;;; newer than compiled /home/jgart/.guix-profile/lib/guile/3.0/site-ccache/gnu/packages/erlang.go ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/guix/build-system/rebar.scm ;;; newer than compiled /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/guix/build-system/rebar.go ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/guix/build-system/rebar.scm ;;; newer than compiled /home/jgart/.guix-profile/lib/guile/3.0/site-ccache/guix/build-system/rebar.go ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/entr.scm ;;; newer than compiled /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/entr.go ;;; note: source file /home/jgart/7a41616f-b6b7-4643-898b-5771ddf02d32-guix/gnu/packages/entr.scm ;;; newer than compiled /home/jgart/.guix-profile/lib/guile/3.0/site-ccache/gnu/packages/entr.go ;;; Ignore this. This was printed courtesy of the pk macro ;() ;;; (#<procedure 7fc6c0e41000 at ice-9/eval.scm:333:13 (a)>) export PATH="/gnu/store/95i56pzs3g1hysaj32c8jzchw5n30fhz-profile/bin" export XDG_DATA_DIRS="/gnu/store/95i56pzs3g1hysaj32c8jzchw5n30fhz-profile/share" guix-shell ls /gnu/store/95i56pzs3g1hysaj32c8jzchw5n30fhz-profile/bin ct_run erl fc-cache fc-list fc-query freetype-config png-fix-itxt to_erl dialyzer erlc fc-cat fc-match fc-scan libpng-config pngfix typer epmd escript fc-conflist fc-pattern fc-validate libpng16-config run_erl xmlwf guix-shell erl bash: erl: command not found (reverse-i-search)`s': ./pre-inst-env guix shell erlang erlang-jsx --search-path^C--pure guix-shell export ERL_LIBS=/gnu/store/95i56pzs3g1hysaj32c8jzchw5n30fhz-profile/lib/erlang/lib guix-shell /gnu/store/95i56pzs3g1hysaj32c8jzchw5n30fhz-profile/bin/erl Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] Eshell V13.0.4 (abort with ^G) 1> jsx:decode(<<"{\"library\": \"jsx\", \"awesome\": true}">>, []). #{<<"awesome">> => true,<<"library">> => <<"jsx">>} As you can see above we don't need to import anything into the repl because we just namespace with installed library in order to use it. I think this may be what erlangers normally do at the repl instead of importing. See the erlang-jsx README: https://github.com/talentdeficit/jsx#to-convert-a-utf8-binary-containing-a-json-string-into-an-erlang-term I'll try to find the time to add setting this environment variable to the rebar-build-system, otherwise if you'd like to proceed with adding it that is also fine by me :) all best, jgart