2021-01-23 13:15:07 +00:00
|
|
|
{ pkgs, lib, stdenv, fetchFromGitHub, erlang, makeWrapper,
|
2017-06-27 04:09:11 +01:00
|
|
|
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
|
2021-01-23 13:15:07 +00:00
|
|
|
inherit (lib) getVersion versionAtLeast optional;
|
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
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ erlang ];
|
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
|
|
|
|
2019-10-28 09:17:49 +00:00
|
|
|
buildFlags = optional debugInfo "ERL_COMPILER_OPTIONS=debug_info";
|
2013-08-07 15:09:08 +01:00
|
|
|
|
2017-06-27 04:09:11 +01:00
|
|
|
preBuild = ''
|
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 \
|
2021-02-09 18:53:55 +00:00
|
|
|
--prefix PATH ":" "${lib.makeBinPath [ erlang coreutils curl bash ]}"
|
2017-06-27 04:09:11 +01:00
|
|
|
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;
|
2021-01-23 13:15:07 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +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;
|
2021-01-23 20:25:40 +00:00
|
|
|
maintainers = teams.beam.members;
|
2017-06-27 04:09:11 +01:00
|
|
|
};
|
|
|
|
})
|