diff mbox series

[bug#66801,v3,02/15] gnu: elixir: Wrap binaries.

Message ID 890f17a9c0c5ea79addb025bec17f08d054cfb5b.1702044562.git.contact@phfrohring.com
State New
Headers show
Series [bug#66801,v3,01/15] build-system: Add mix-build-system. | expand

Commit Message

Pierre-Henry Fröhring Dec. 8, 2023, 2:27 p.m. UTC
* gnu/packages/elixir.scm (elixir)[arguments]: Phase `wrap-programs' added.
* gnu/packages/elixir.scm (elixir)[native-search-paths]: Variable
`GUIX_ELIXIR_LIBS' added.

Change-Id: I75bdde3aeedc1d495ea5fc2c5fc3fcdc5dc3fad2
---
 gnu/packages/elixir.scm | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 724b42512..15cbdbdfc 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -27,6 +27,7 @@  (define-module (gnu packages elixir)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
   #:use-module (guix gexp)
+  #:use-module (guix utils)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (gnu packages)
@@ -96,9 +97,20 @@  (define-public elixir
             (lambda* (#:key inputs #:allow-other-keys)
               ;; Some tests require access to a home directory.
               (setenv "HOME" "/tmp")))
-          (delete 'configure))))
-    (inputs
-     (list erlang git))
+          (delete 'configure)
+          (add-after 'install 'wrap-programs
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (programs '("elixir" "elixirc" "iex" "mix")))
+                (for-each (lambda (program)
+                            (wrap-program (string-append out "/bin/" program)
+                              '("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))
+                          programs)))))))
+    (inputs (list erlang git))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_ELIXIR_LIBS")
+            (files (list (string-append "lib/elixir/" (version-major+minor version)))))))
     (home-page "https://elixir-lang.org/")
     (synopsis "Elixir programming language")
     (description "Elixir is a dynamic, functional language used to build