diff mbox series

[bug#66801,v3,03/15] gnu: Add elixir-hex.

Message ID 937fdf197914163a125e2e8a12497fb9ebbde81b.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
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>

* gnu/packages/elixir.scm (elixir-hex): New variable.

Change-Id: I957688ae4e078afd79acd439880c38083fdab83a
---
 gnu/packages/elixir.scm | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Liliana Marie Prikler Dec. 8, 2023, 3:29 p.m. UTC | #1
Am Freitag, dem 08.12.2023 um 15:27 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
> 
> * gnu/packages/elixir.scm (elixir-hex): New variable.
> 
> Change-Id: I957688ae4e078afd79acd439880c38083fdab83a
> ---
>  gnu/packages/elixir.scm | 43
> +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
> index 15cbdbdfc..cb9074526 100644
> --- a/gnu/packages/elixir.scm
> +++ b/gnu/packages/elixir.scm
> @@ -118,3 +118,46 @@ (define-public elixir
>  for running low-latency, distributed and fault-tolerant systems,
> while also
>  being successfully used in web development and the embedded software
> domain.")
>      (license license:asl2.0)))
> +
> +(define-public elixir-hex
> +  (package
> +    (name "elixir-hex")
> +    (version "2.0.5")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/hexpm/hex.git")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32
> +         "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
> +    ;; The mix-build-system assumes that Hex exists.
> +    ;; We build Hex using the gnu-build-system.
> +    ;; Other Elixir packages use the mix-build-system.
> +    (build-system gnu-build-system)
> +    (inputs (list elixir))
> +    (arguments
> +     (list
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (delete 'bootstrap)
> +          (delete 'configure)
> +          (replace 'build
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              (setenv "MIX_ENV" "prod")
> +              (invoke "mix" "compile")))
> +          (delete 'check)
Instead of (delete 'check), use #:tests? #f with an appropriate
comment.
> +          (replace 'install
> +            (lambda* (#:key inputs outputs #:allow-other-keys)
> +              (define X.Y #$(version-major+minor (package-version
> elixir)))
> +              (define out (string-append (assoc-ref outputs "out")
> "/lib/elixir/" X.Y "/hex"))
> +              (mkdir-p out)
> +              (copy-recursively "_build/prod/lib/hex" out))))))
> +    (synopsis "Package manager for the Erlang VM")
> +    (description
> +     "This project provides tasks that integrate with Mix, Elixir's
> build
> +tool.")
> +    (home-page "https://hexdocs.pm/makeup_elixir/")
> +    (license license:bsd-2)))

Cheers
diff mbox series

Patch

diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 15cbdbdfc..cb9074526 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -118,3 +118,46 @@  (define-public elixir
 for running low-latency, distributed and fault-tolerant systems, while also
 being successfully used in web development and the embedded software domain.")
     (license license:asl2.0)))
+
+(define-public elixir-hex
+  (package
+    (name "elixir-hex")
+    (version "2.0.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hexpm/hex.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
+    ;; The mix-build-system assumes that Hex exists.
+    ;; We build Hex using the gnu-build-system.
+    ;; Other Elixir packages use the mix-build-system.
+    (build-system gnu-build-system)
+    (inputs (list elixir))
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'bootstrap)
+          (delete 'configure)
+          (replace 'build
+            (lambda* (#:key inputs #:allow-other-keys)
+              (setenv "MIX_ENV" "prod")
+              (invoke "mix" "compile")))
+          (delete 'check)
+          (replace 'install
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (define X.Y #$(version-major+minor (package-version elixir)))
+              (define out (string-append (assoc-ref outputs "out") "/lib/elixir/" X.Y "/hex"))
+              (mkdir-p out)
+              (copy-recursively "_build/prod/lib/hex" out))))))
+    (synopsis "Package manager for the Erlang VM")
+    (description
+     "This project provides tasks that integrate with Mix, Elixir's build
+tool.")
+    (home-page "https://hexdocs.pm/makeup_elixir/")
+    (license license:bsd-2)))