2017-06-27 04:09:11 +01:00
|
|
|
{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper,
|
|
|
|
coreutils, curl, bash, debugInfo ? false }:
|
2017-06-23 01:34:32 +01:00
|
|
|
|
|
|
|
{ baseName ? "elixir"
|
|
|
|
, version
|
2017-06-27 04:09:11 +01:00
|
|
|
, minimumOTPVersion
|
2017-06-23 01:34:32 +01:00
|
|
|
, sha256 ? null
|
|
|
|
, rev ? "v${version}"
|
|
|
|
, src ? fetchFromGitHub { inherit rev sha256; owner = "elixir-lang"; repo = "elixir"; }
|
2019-01-29 16:47:15 +00:00
|
|
|
} @ args:
|
2017-06-23 01:34:32 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
let
|
|
|
|
inherit (stdenv.lib) getVersion versionAtLeast;
|
2017-06-23 01:34:32 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
in
|
|
|
|
assert versionAtLeast (getVersion erlang) minimumOTPVersion;
|
2013-08-07 15:06:11 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "${baseName}-${version}";
|
2013-08-07 15:06:11 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
inherit src version;
|
2016-01-12 13:53:31 +00:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
buildInputs = [ erlang rebar makeWrapper ];
|
2016-04-01 21:13:02 +01:00
|
|
|
|
2019-06-21 10:03:34 +01:00
|
|
|
LANG = "C.UTF-8";
|
|
|
|
LC_TYPE = "C.UTF-8";
|
2016-06-15 15:15:06 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
setupHook = ./setup-hook.sh;
|
2016-03-30 18:19:55 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
inherit debugInfo;
|
2014-02-08 18:05:31 +00:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
buildFlags = if debugInfo
|
2017-10-03 18:01:47 +01:00
|
|
|
then "ERL_COMPILER_OPTIONS=debug_info"
|
|
|
|
else "";
|
2013-08-07 15:09:08 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
preBuild = ''
|
|
|
|
# The build process uses ./rebar. Link it to the nixpkgs rebar
|
2018-07-25 22:48:29 +01:00
|
|
|
rm -vf rebar
|
2017-06-27 04:09:11 +01:00
|
|
|
ln -s ${rebar}/bin/rebar rebar
|
2013-08-26 01:44:54 +01:00
|
|
|
|
2018-08-04 21:44:01 +01:00
|
|
|
patchShebangs lib/elixir/generate_app.escript || true
|
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "/usr/local" $out
|
|
|
|
'';
|
2015-09-06 04:33:01 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
postFixup = ''
|
|
|
|
# Elixir binaries are shell scripts which run erl. Add some stuff
|
|
|
|
# to PATH so the scripts can run without problems.
|
2013-08-26 01:44:54 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
for f in $out/bin/*; do
|
|
|
|
b=$(basename $f)
|
2017-07-09 01:32:16 +01:00
|
|
|
if [ "$b" = mix ]; then continue; fi
|
2017-06-27 04:09:11 +01:00
|
|
|
wrapProgram $f \
|
|
|
|
--prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \
|
|
|
|
--set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
|
|
|
|
done
|
2013-08-07 15:09:08 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
substituteInPlace $out/bin/mix \
|
|
|
|
--replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir"
|
2013-08-07 15:09:08 +01:00
|
|
|
'';
|
|
|
|
|
2019-01-29 16:47:15 +00:00
|
|
|
pos = builtins.unsafeGetAttrPos "sha256" args;
|
2017-06-27 04:09:11 +01:00
|
|
|
meta = with stdenv.lib; {
|
2017-08-09 09:51:14 +01:00
|
|
|
homepage = https://elixir-lang.org/;
|
2017-06-27 04:09:11 +01:00
|
|
|
description = "A functional, meta-programming aware language built on top of the Erlang VM";
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Elixir is a functional, meta-programming aware language built on
|
|
|
|
top of the Erlang VM. It is a dynamic language with flexible
|
|
|
|
syntax and macro support that leverages Erlang's abilities to
|
|
|
|
build concurrent, distributed and fault-tolerant applications
|
|
|
|
with hot code upgrades.
|
|
|
|
'';
|
|
|
|
|
|
|
|
license = licenses.epl10;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ the-kenny havvy couchemar ankhers ];
|
|
|
|
};
|
|
|
|
})
|