all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Giacomo Leidi <goodoldpaul@autistici.org>, 73458@debbugs.gnu.org
Subject: [bug#73458] [PATCH 1/2] build-system: mix: Allow loading Erlang dependencies in Mix driven builds.
Date: Wed, 25 Sep 2024 20:42:47 +0200	[thread overview]
Message-ID: <6cf3afb19eb7e810b9b4c422c07246b99d15830f.camel@gmail.com> (raw)
In-Reply-To: <58afb3593e28f5f670b2be516a165b59e2665276.1727252673.git.goodoldpaul@autistici.org>

Am Mittwoch, dem 25.09.2024 um 10:24 +0200 schrieb Giacomo Leidi:
> Fixes <https://issues.guix.gnu.org/73453>
Note: It's not official yet, but Fixes: <URL> is nice for a trailer. 
If it fits into 80 columns, you can also do Fixes: [shortdoc] <URL>.

> * guix/build/mix-build-system.scm (elixir-relative-libdir): New
> variable;
> (elixir-libdir): call elixir-relative-libdir;
Use full sentences, end each with a period (dot).
> (set-erl-env): this new phase sets ERL_LIBS to allow Erlang's virtual
> machine to load Erlang dependencies in Mix builds, in addition to
> Elixir
> ones;
> (%standard-phases): add set-erl-env phases.
> 
> Change-Id: Ic1ef5db20680bfd265fbac72bafb760d21135f68
> ---
>  guix/build/mix-build-system.scm | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-
> system.scm
> index 0b021da791..41f6061444 100644
> --- a/guix/build/mix-build-system.scm
> +++ b/guix/build/mix-build-system.scm
> @@ -1,6 +1,7 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
>  ;;; Copyright © 2024 Igor Goryachev <igor@goryachev.org>
> +;;; Copyright © 2024 Giacomo Leidi <goodoldpaul@autistici.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -39,10 +40,15 @@ (define-module (guix build mix-build-system)
>  ;; minor version number of the Elixir used in the build.
>  (define %elixir-version (make-parameter "X.Y"))
>  
> +(define (elixir-relative-libdir version)
> +  "Return the relative path inside a package namespace in the store
> where all
> +libraries for a specified Elixir VERSION are installed."
> +  (string-append "lib/elixir/" version))
> +
>  (define* (elixir-libdir path #:optional (version (%elixir-version)))
>    "Return the path where all libraries under PATH for a specified
> Elixir
>  VERSION are installed."
> -  (string-append path "/lib/elixir/" version))
> +  (string-append path "/" (elixir-relative-libdir version)))
Rather than having two procedures here, I think calling elixir-libdir
on "lib/erlang/lib" does what you want.


>  (define* (strip-prefix name #:optional (prefix "elixir-"))
>    "Return NAME without the prefix PREFIX."
> @@ -94,6 +100,17 @@ (define* (set-mix-env #:key inputs mix-path mix-
> exs #:allow-other-keys)
>    (setenv "MIX_PATH" (or mix-path ""))
>    (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> "/bin/rebar3")))
>  
> +(define* (set-erl-env #:key inputs #:allow-other-keys)
> +  "Add dependencies in Elixir's load path."
> +  (setenv "ERL_LIBS"
> +          (string-join (search-path-as-list
> +                        `("lib/erlang/lib"
> +                          ,(elixir-relative-libdir (elixir-version
> inputs)))
> +                        (map (match-lambda
> +                               ((label . package) package))
> +                             inputs))
> +                       ":")))
> +
>  (define* (set-elixir-version #:key inputs #:allow-other-keys)
>    "Store the version number of the Elixir input in a parameter."
>    (%elixir-version (elixir-version inputs))
> @@ -152,6 +169,7 @@ (define %standard-phases
>      (delete 'configure)
>      (add-after 'install-locale 'set-mix-env set-mix-env)
>      (add-after 'set-mix-env 'set-elixir-version set-elixir-version)
> +    (add-after 'set-elixir-version 'set-erl-env set-erl-env)
I think we can reorder this so that set-elixir-version is called first
and set-erl-env can be inlined into set-mix-env.

Cheers




  parent reply	other threads:[~2024-09-25 18:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 17:03 [bug#73458] Fix mix-build-system bugs (73453 , 73454) paul via Guix-patches via
2024-09-25  8:24 ` [bug#73458] [PATCH 1/2] build-system: mix: Allow loading Erlang dependencies in Mix driven builds Giacomo Leidi via Guix-patches via
2024-09-25  8:24   ` [bug#73458] [PATCH 2/2] build-system: mix: Fix decoding of package names with git versions Giacomo Leidi via Guix-patches via
2024-09-25 19:54     ` Liliana Marie Prikler
2024-09-25 21:30       ` paul via Guix-patches via
2024-09-25 18:42   ` Liliana Marie Prikler [this message]
2024-09-25 21:39 ` [bug#73458] [PATCH v2 1/2] build-system: mix: Allow loading Erlang dependencies in Mix driven builds Giacomo Leidi via Guix-patches via
2024-09-25 21:39   ` [bug#73458] [PATCH v2 2/2] build-system: mix: Fix decoding of package names with git versions Giacomo Leidi via Guix-patches via
2024-10-12 17:51   ` bug#73458: Fix mix-build-system bugs (73453 , 73454) Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cf3afb19eb7e810b9b4c422c07246b99d15830f.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=73458@debbugs.gnu.org \
    --cc=goodoldpaul@autistici.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.