guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: gnu: elixir: Remove wrap for mix.


From: guix-commits
Subject: branch master updated: gnu: elixir: Remove wrap for mix.
Date: Thu, 08 Feb 2024 04:30:47 -0500

This is an automated email from the git hooks/post-receive script.

abcdw pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new a903558577 gnu: elixir: Remove wrap for mix.
a903558577 is described below

commit a903558577d249354aa74bbd6aab897235a7602b
Author: Andrew Tropin <andrew@trop.in>
AuthorDate: Wed Feb 7 09:30:38 2024 +0300

    gnu: elixir: Remove wrap for mix.
    
    * 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
---
 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 @@
           (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}"))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]