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 ;;; Copyright © 2021 Oskar Köök ;;; Copyright © 2021 Cees de Groot +;;; Copyright © 2024 Andrew Tropin +;;; Copyright © 2024 Ivan Sokolov ;;; ;;; 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}"))))