2017-06-27 03:09:11 +00:00
|
|
|
{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper,
|
|
|
|
coreutils, curl, bash, debugInfo ? false }:
|
2017-06-23 00:34:32 +00:00
|
|
|
|
|
|
|
{ baseName ? "elixir"
|
|
|
|
, version
|
2017-06-27 03:09:11 +00:00
|
|
|
, minimumOTPVersion
|
2017-06-23 00:34:32 +00:00
|
|
|
, sha256 ? null
|
|
|
|
, rev ? "v${version}"
|
|
|
|
, src ? fetchFromGitHub { inherit rev sha256; owner = "elixir-lang"; repo = "elixir"; }
|
|
|
|
}:
|
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
let
|
|
|
|
inherit (stdenv.lib) getVersion versionAtLeast;
|
2017-06-23 00:34:32 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
in
|
|
|
|
assert versionAtLeast (getVersion erlang) minimumOTPVersion;
|
2013-08-07 14:06:11 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "${baseName}-${version}";
|
2013-08-07 14:06:11 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
inherit src version;
|
2016-01-12 13:53:31 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
buildInputs = [ erlang rebar makeWrapper ];
|
2016-04-01 20:13:02 +00:00
|
|
|
|
2017-10-03 17:01:47 +00:00
|
|
|
LOCALE_ARCHIVE = stdenv.lib.optionalString stdenv.isLinux
|
|
|
|
"${pkgs.glibcLocales}/lib/locale/locale-archive";
|
2017-06-27 03:09:11 +00:00
|
|
|
LANG = "en_US.UTF-8";
|
|
|
|
LC_TYPE = "en_US.UTF-8";
|
2016-06-15 14:15:06 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
2016-03-30 17:19:55 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
inherit debugInfo;
|
2014-02-08 18:05:31 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
buildFlags = if debugInfo
|
2017-10-03 17:01:47 +00:00
|
|
|
then "ERL_COMPILER_OPTIONS=debug_info"
|
|
|
|
else "";
|
2013-08-07 14:09:08 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
preBuild = ''
|
|
|
|
# The build process uses ./rebar. Link it to the nixpkgs rebar
|
|
|
|
rm -v rebar
|
|
|
|
ln -s ${rebar}/bin/rebar rebar
|
2013-08-26 00:44:54 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "/usr/local" $out
|
|
|
|
'';
|
2015-09-06 03:33:01 +00:00
|
|
|
|
2017-06-27 03:09:11 +00: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 00:44:54 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
for f in $out/bin/*; do
|
|
|
|
b=$(basename $f)
|
2017-07-09 00:32:16 +00:00
|
|
|
if [ "$b" = mix ]; then continue; fi
|
2017-06-27 03:09:11 +00: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 14:09:08 +00:00
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
substituteInPlace $out/bin/mix \
|
|
|
|
--replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir"
|
2013-08-07 14:09:08 +00:00
|
|
|
'';
|
|
|
|
|
2017-06-27 03:09:11 +00:00
|
|
|
meta = with stdenv.lib; {
|
2017-08-09 08:51:14 +00:00
|
|
|
homepage = https://elixir-lang.org/;
|
2017-06-27 03:09:11 +00: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 ];
|
|
|
|
};
|
|
|
|
})
|