all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Erlang Development with Guix
@ 2022-06-30  1:27 jgart
  2022-06-30  9:00 ` Hartmut Goebel
  0 siblings, 1 reply; 3+ messages in thread
From: jgart @ 2022-06-30  1:27 UTC (permalink / raw)
  To: Guix Help

Hi Guixers,

Has anyone tried loading any guix installed erlang libraries yet?

I was thinking in an erlang shell (repl).

Is there a guide that shows the particularities of using erlang with
guix for development, or a mailing list thread I can read?

Any help with that is much appreciated.

all best,

jgart


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

* Re: Erlang Development with Guix
  2022-06-30  1:27 Erlang Development with Guix jgart
@ 2022-06-30  9:00 ` Hartmut Goebel
  2022-10-12  3:13   ` jgart
  0 siblings, 1 reply; 3+ messages in thread
From: Hartmut Goebel @ 2022-06-30  9:00 UTC (permalink / raw)
  To: jgart, Guix Help

Am 30.06.22 um 03:27 schrieb jgart:
> Is there a guide that shows the particularities of using erlang with
> guix for development, or a mailing list thread I can read?

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.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |



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

* Re: Erlang Development with Guix
  2022-06-30  9:00 ` Hartmut Goebel
@ 2022-10-12  3:13   ` jgart
  0 siblings, 0 replies; 3+ messages in thread
From: jgart @ 2022-10-12  3:13 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: Guix Help

On Thu, 30 Jun 2022 11:00:03 +0200 Hartmut Goebel <h.goebel@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


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

end of thread, other threads:[~2022-10-12  3:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-30  1:27 Erlang Development with Guix jgart
2022-06-30  9:00 ` Hartmut Goebel
2022-10-12  3:13   ` jgart

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.