all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#68964] [PATCH] gnu: elixir: Remove wrap for mix.
@ 2024-02-07  6:39 Andrew Tropin via Guix-patches via
  2024-02-07  8:13 ` [bug#68964] [PATCH v2] " Andrew Tropin via Guix-patches via
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Tropin via Guix-patches via @ 2024-02-07  6:39 UTC (permalink / raw)
  To: 68964; +Cc: Pierre-Henry Fröhring, Liliana Marie Prikler, Andrew Tropin

* gnu/packages/elixir.scm (elixir)[#:phases]: Instead of wrapping mix into
shell script, which sets environment variables, we patch mix itself and set
environmnet variables via elixir code.

Change-Id: Ia4643e18fe927491242a0541938b7570bd56fca1
---
 gnu/packages/elixir.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index ef8c39d0d7..70a8fad5e8 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -101,7 +101,18 @@ (define-public elixir
           (add-after 'install 'wrap-programs
             (lambda* (#:key inputs outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
-                     (programs '("elixir" "elixirc" "iex" "mix")))
+                     (programs '("elixir" "elixirc" "iex")))
+                ;; mix can be sourced as an elixir script by other elixir
+                ;; program, for example `iex -S mix`, so we should not wrap
+                ;; mix into shell script.
+                (substitute* (string-append out "/bin/mix")
+                  (("Mix.start\\(\\)") "\
+~w[GUIX_ELIXIR_LIBS ERL_LIBS]
+|> Enum.map(&System.get_env/1)
+|> Enum.reject(&is_nil/1)
+|> Enum.join(\":\")
+|> case do \"\" -> :ok; erl_libs -> System.put_env(\"ERL_LIBS\", erl_libs) end
+Mix.start()"))
                 (for-each (lambda (program)
                             (wrap-program (string-append out "/bin/" program)
                               '("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))

base-commit: cce7a6d2d2b18f51d1fcab67b02a38c11d6f4f2d
-- 
2.41.0





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

* [bug#68964] [PATCH v2] gnu: elixir: Remove wrap for mix.
  2024-02-07  6:39 [bug#68964] [PATCH] gnu: elixir: Remove wrap for mix Andrew Tropin via Guix-patches via
@ 2024-02-07  8:13 ` Andrew Tropin via Guix-patches via
  2024-02-07 18:22   ` Liliana Marie Prikler
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Tropin via Guix-patches via @ 2024-02-07  8:13 UTC (permalink / raw)
  To: 68964
  Cc: Pierre-Henry Fröhring, Ivan Sokolov, Liliana Marie Prikler,
	Andrew Tropin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=en_US.utf8, Size: 2113 bytes --]

* gnu/packages/elixir.scm (elixir)[#:phases]: Instead of wrapping mix into
shell script, which sets environment variables, we patch mix itself and set
environmnet variables via elixir code.

Change-Id: Ia4643e18fe927491242a0541938b7570bd56fca1

Co-authored-by: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Change-Id: I29d2c61299a8a54125f0e15190c526a860d501da
---
Changes since v1: Added Ivan's copyright and co-authored-by.

 gnu/packages/elixir.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index ef8c39d0d7..2d11707711 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -7,6 +7,8 @@
 ;;; Copyright © 2018 Nikita <nikita@n0.is>
 ;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
 ;;; Copyright © 2021 Cees de Groot <cg@evrl.com>
+;;; Copyright © 2024 Andrew Tropin <andrew@trop.in>
+;;; Copyright © 2024 Ivan Sokolov <ivan-p-sokolov@ya.ru>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -101,7 +103,18 @@ (define-public elixir
           (add-after 'install 'wrap-programs
             (lambda* (#:key inputs outputs #:allow-other-keys)
               (let* ((out (assoc-ref outputs "out"))
-                     (programs '("elixir" "elixirc" "iex" "mix")))
+                     (programs '("elixir" "elixirc" "iex")))
+                ;; mix can be sourced as an elixir script by other elixir
+                ;; program, for example `iex -S mix`, so we should not wrap
+                ;; mix into shell script.
+                (substitute* (string-append out "/bin/mix")
+                  (("Mix.start\\(\\)") "\
+~w[GUIX_ELIXIR_LIBS ERL_LIBS]
+|> Enum.map(&System.get_env/1)
+|> Enum.reject(&is_nil/1)
+|> Enum.join(\":\")
+|> case do \"\" -> :ok; erl_libs -> System.put_env(\"ERL_LIBS\", erl_libs) end
+Mix.start()"))
                 (for-each (lambda (program)
                             (wrap-program (string-append out "/bin/" program)
                               '("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))

base-commit: cce7a6d2d2b18f51d1fcab67b02a38c11d6f4f2d
-- 
2.41.0





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

* [bug#68964] [PATCH v2] gnu: elixir: Remove wrap for mix.
  2024-02-07  8:13 ` [bug#68964] [PATCH v2] " Andrew Tropin via Guix-patches via
@ 2024-02-07 18:22   ` Liliana Marie Prikler
  2024-02-08  9:39     ` bug#68964: " Andrew Tropin via Guix-patches via
  0 siblings, 1 reply; 4+ messages in thread
From: Liliana Marie Prikler @ 2024-02-07 18:22 UTC (permalink / raw)
  To: Andrew Tropin, 68964; +Cc: Pierre-Henry Fröhring, Ivan Sokolov

Am Mittwoch, dem 07.02.2024 um 11:13 +0300 schrieb Andrew Tropin:
> * gnu/packages/elixir.scm (elixir)[#:phases]: Instead of wrapping mix
> into
> shell script, which sets environment variables, we patch mix itself
> and set
> environmnet variables via elixir code.
> 
> Change-Id: Ia4643e18fe927491242a0541938b7570bd56fca1
> 
> Co-authored-by: Ivan Sokolov <ivan-p-sokolov@ya.ru>
> Change-Id: I29d2c61299a8a54125f0e15190c526a860d501da
> ---
> Changes since v1: Added Ivan's copyright and co-authored-by.
> 
>  gnu/packages/elixir.scm | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
> index ef8c39d0d7..2d11707711 100644
> --- a/gnu/packages/elixir.scm
> +++ b/gnu/packages/elixir.scm
> @@ -7,6 +7,8 @@
>  ;;; Copyright © 2018 Nikita <nikita@n0.is>
>  ;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
>  ;;; Copyright © 2021 Cees de Groot <cg@evrl.com>
> +;;; Copyright © 2024 Andrew Tropin <andrew@trop.in>
> +;;; Copyright © 2024 Ivan Sokolov <ivan-p-sokolov@ya.ru>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -101,7 +103,18 @@ (define-public elixir
>            (add-after 'install 'wrap-programs
>              (lambda* (#:key inputs outputs #:allow-other-keys)
>                (let* ((out (assoc-ref outputs "out"))
> -                     (programs '("elixir" "elixirc" "iex" "mix")))
> +                     (programs '("elixir" "elixirc" "iex")))
> +                ;; mix can be sourced as an elixir script by other
> elixir
> +                ;; program, for example `iex -S mix`, so we should
> not wrap
> +                ;; mix into shell script.
> +                (substitute* (string-append out "/bin/mix")
> +                  (("Mix.start\\(\\)") "\
> +~w[GUIX_ELIXIR_LIBS ERL_LIBS]
> +|> Enum.map(&System.get_env/1)
> +|> Enum.reject(&is_nil/1)
> +|> Enum.join(\":\")
> +|> case do \"\" -> :ok; erl_libs -> System.put_env(\"ERL_LIBS\",
> erl_libs) end
> +Mix.start()"))
You might want to make a patch for that.  I don't speak Elixir, but
from what I understand, this LGTM.

Cheers




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

* bug#68964: [PATCH v2] gnu: elixir: Remove wrap for mix.
  2024-02-07 18:22   ` Liliana Marie Prikler
@ 2024-02-08  9:39     ` Andrew Tropin via Guix-patches via
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Tropin via Guix-patches via @ 2024-02-08  9:39 UTC (permalink / raw)
  To: Liliana Marie Prikler, 68964-done
  Cc: Pierre-Henry Fröhring, Ivan Sokolov

[-- Attachment #1: Type: text/plain, Size: 2877 bytes --]

On 2024-02-07 19:22, Liliana Marie Prikler wrote:

> Am Mittwoch, dem 07.02.2024 um 11:13 +0300 schrieb Andrew Tropin:
>> * gnu/packages/elixir.scm (elixir)[#:phases]: Instead of wrapping mix
>> into
>> shell script, which sets environment variables, we patch mix itself
>> and set
>> environmnet variables via elixir code.
>> 
>> Change-Id: Ia4643e18fe927491242a0541938b7570bd56fca1
>> 
>> Co-authored-by: Ivan Sokolov <ivan-p-sokolov@ya.ru>
>> Change-Id: I29d2c61299a8a54125f0e15190c526a860d501da
>> ---
>> Changes since v1: Added Ivan's copyright and co-authored-by.
>> 
>>  gnu/packages/elixir.scm | 15 ++++++++++++++-
>>  1 file changed, 14 insertions(+), 1 deletion(-)
>> 
>> diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
>> index ef8c39d0d7..2d11707711 100644
>> --- a/gnu/packages/elixir.scm
>> +++ b/gnu/packages/elixir.scm
>> @@ -7,6 +7,8 @@
>>  ;;; Copyright © 2018 Nikita <nikita@n0.is>
>>  ;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
>>  ;;; Copyright © 2021 Cees de Groot <cg@evrl.com>
>> +;;; Copyright © 2024 Andrew Tropin <andrew@trop.in>
>> +;;; Copyright © 2024 Ivan Sokolov <ivan-p-sokolov@ya.ru>
>>  ;;;
>>  ;;; This file is part of GNU Guix.
>>  ;;;
>> @@ -101,7 +103,18 @@ (define-public elixir
>>            (add-after 'install 'wrap-programs
>>              (lambda* (#:key inputs outputs #:allow-other-keys)
>>                (let* ((out (assoc-ref outputs "out"))
>> -                     (programs '("elixir" "elixirc" "iex" "mix")))
>> +                     (programs '("elixir" "elixirc" "iex")))
>> +                ;; mix can be sourced as an elixir script by other
>> elixir
>> +                ;; program, for example `iex -S mix`, so we should
>> not wrap
>> +                ;; mix into shell script.
>> +                (substitute* (string-append out "/bin/mix")
>> +                  (("Mix.start\\(\\)") "\
>> +~w[GUIX_ELIXIR_LIBS ERL_LIBS]
>> +|> Enum.map(&System.get_env/1)
>> +|> Enum.reject(&is_nil/1)
>> +|> Enum.join(\":\")
>> +|> case do \"\" -> :ok; erl_libs -> System.put_env(\"ERL_LIBS\",
>> erl_libs) end
>> +Mix.start()"))
> You might want to make a patch for that.  I don't speak Elixir, but
> from what I understand, this LGTM.

Thank you for reply!  Patch make sense for the consistency with similiar
fixes for other applications, however, it is also reasonable to keep the
logic of adding support for GUIX_ELIXIR_LIBS to all elixir binaries in
one build phase.  Both options seems viable to me, I'll stick with
substitute solution for now.

Applied and pushed as
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=a903558577

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2024-02-08  9:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07  6:39 [bug#68964] [PATCH] gnu: elixir: Remove wrap for mix Andrew Tropin via Guix-patches via
2024-02-07  8:13 ` [bug#68964] [PATCH v2] " Andrew Tropin via Guix-patches via
2024-02-07 18:22   ` Liliana Marie Prikler
2024-02-08  9:39     ` bug#68964: " Andrew Tropin via Guix-patches via

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.