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