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"; }
|
|
|
|
}:
|
|
|
|
|
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
|
|
|
|
2017-10-03 18:01:47 +01:00
|
|
|
LOCALE_ARCHIVE = stdenv.lib.optionalString stdenv.isLinux
|
|
|
|
"${pkgs.glibcLocales}/lib/locale/locale-archive";
|
2017-06-27 04:09:11 +01:00
|
|
|
LANG = "en_US.UTF-8";
|
|
|
|
LC_TYPE = "en_US.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
|
|
|
|
rm -v rebar
|
|
|
|
ln -s ${rebar}/bin/rebar rebar
|
2013-08-26 01:44:54 +01:00
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
})
|