GNU bug report logs - #68964
[PATCH] gnu: elixir: Remove wrap for mix.

Previous Next

Package: guix-patches;

Reported by: Andrew Tropin <andrew <at> trop.in>

Date: Wed, 7 Feb 2024 06:44:01 UTC

Severity: normal

Tags: patch

Done: Andrew Tropin <andrew <at> trop.in>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: guix-patches <at> gnu.org
Cc: Pierre-Henry Fröhring <contact <at> phfrohring.com>,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>,
 Andrew Tropin <andrew <at> trop.in>
Subject: [PATCH] gnu: elixir: Remove wrap for mix.
Date: Wed,  7 Feb 2024 09:39:22 +0300
* 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





This bug report was last modified 1 year and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.