;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 nee <nee.git@cock.li>
-;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 ng0 <ng0@n0.is>
+;;; Copyright © 2018, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Nikita <nikita@n0.is>
+;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
;;;
;;; This file is part of GNU Guix.
;;;
(define-module (gnu packages elixir)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
- #:use-module (guix download)
+ #:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (gnu packages)
#:use-module (gnu packages erlang)
(define-public elixir
(package
(name "elixir")
- (version "1.8.2")
- (source (origin
- (method url-fetch)
- (uri (string-append "https://github.com/elixir-lang/elixir"
- "/archive/v" version ".tar.gz"))
- (file-name (string-append name "-" version ".tar.gz"))
- (sha256
- (base32
- "0ddqxw24zdqlg7glzk22m7qjal8f18divzp364a6gi1bv6rg16yg"))
- (patches (search-patches "elixir-path-length.patch"))))
+ (version "1.11.4")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/elixir-lang/elixir")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1y8fbhli29agf84ja0fwz6gf22a46738b50nwy26yvcl2n2zl9d8"))
+ (patches (search-patches "elixir-path-length.patch"))))
(build-system gnu-build-system)
(arguments
`(#:test-target "test"
(assoc-ref %outputs "out")))
#:phases
(modify-phases %standard-phases
- (add-after 'unpack 'replace-paths
+ (add-after 'unpack 'make-git-checkout-writable
+ (lambda _
+ (for-each make-file-writable (find-files "."))
+ #t))
+ (add-after 'make-git-checkout-writable 'replace-paths
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(substitute* '("lib/elixir/lib/system.ex"
"lib/mix/lib/mix/scm/git.ex")
(("(cmd\\(['\"])git" _ prefix)
(string-append prefix (which "git"))))
+ (substitute* '("lib/mix/lib/mix/release.ex"
+ "lib/mix/lib/mix/tasks/release.init.ex")
+ (("#!/bin/sh")
+ (string-append "#!" (which "sh"))))
(substitute* "bin/elixir"
- (("ERL_EXEC=\"erl\"")
- (string-append "ERL_EXEC=" (which "erl"))))
+ (("ERTS_BIN=")
+ (string-append
+ "ERTS_BIN="
+ ;; Elixir Releases will prepend to ERTS_BIN the path of a copy of erl.
+ ;; We detect if a release is being generated by checking the initial ERTS_BIN
+ ;; value: if it's empty, we are not in release mode and can point to the actual
+ ;; erl binary in Guix store.
+ "\nif [ -z \"$ERTS_BIN\" ]; then ERTS_BIN="
+ (string-drop-right (which "erl") 3)
+ "; fi")))
(substitute* "bin/mix"
(("#!/usr/bin/env elixir")
(string-append "#!" out "/bin/elixir"))))