Generalize building of Elixir interpreter

This commit is contained in:
Justin Wood 2017-06-22 20:34:32 -04:00
parent 3270545094
commit 019afb0c80
7 changed files with 48 additions and 18 deletions

View file

@ -42,6 +42,7 @@
andrewrk = "Andrew Kelley <superjoe30@gmail.com>";
andsild = "Anders Sildnes <andsild@gmail.com>";
aneeshusa = "Aneesh Agrawal <aneeshusa@gmail.com>";
ankhers = "Justin Wood <justin.k.wood@gmail.com>";
antono = "Antono Vasiljev <self@antono.info>";
apeschar = "Albert Peschar <albert@peschar.net>";
apeyroux = "Alexandre Peyroux <alex@px.io>";

View file

@ -37,9 +37,16 @@ let
buildMix = callPackage ./build-mix.nix {};
# BEAM-based languages.
elixir = if versionAtLeast (lib.getVersion erlang) "18"
then callPackage ../interpreters/elixir { debugInfo = true; }
else throw "Elixir requires at least Erlang/OTP R18.";
elixir = defaultScope.elixir-1_4;
elixir-1_4 = if versionAtLeast (lib.getVersion erlang) "18"
then lib.callElixir ../interpreters/elixir/1.4.nix { debugInfo = true; }
else throw "Elixir requires at least Erlang/OTP R18.";
elixir-1_3 = if versionAtLeast (lib.getVersion erlang) "18"
then lib.callElixir ../interpreters/elixir/1.3.nix { debugInfo = true; }
else throw "Elixir requires at least Erlang/OTP R18.";
lfe = callPackage ../interpreters/lfe { };
# Non hex packages

View file

@ -43,4 +43,12 @@ rec {
mkDerivation = pkgs.makeOverridable builder;
};
callElixir = drv: args:
let
builder = callPackage ../../development/interpreters/elixir/generic-builder.nix args;
in
callPackage drv {
mkDerivation = pkgs.makeOverridable builder;
};
}

View file

@ -0,0 +1,6 @@
{ mkDerivation }:
mkDerivation rec {
version = "1.3.4";
sha256 = "01qqv1ghvfadcwcr5p88w8j217cgaf094pmpqllij3l0q1yg104l";
}

View file

@ -0,0 +1,6 @@
{ mkDerivation }:
mkDerivation rec {
version = "1.4.5";
sha256 = "18ivcxmh5bak13k3rjy7jjzin57rgb2nffhwnqb2wl7bpi8mrarw";
}

View file

@ -1,21 +1,20 @@
{ stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl, bash,
debugInfo ? false }:
{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, coreutils, curl
, bash, debugInfo ? false }:
stdenv.mkDerivation rec {
name = "elixir-${version}";
version = "1.4.4";
{ baseName ? "elixir"
, version
, sha256 ? null
, rev ? "v${version}"
, src ? fetchFromGitHub { inherit rev sha256; owner = "elixir-lang"; repo = "elixir"; }
}:
src = fetchFromGitHub {
owner = "elixir-lang";
repo = "elixir";
rev = "v${version}";
sha256 = "0m51cirkv1dahw4z2jlmz58cwmpy0dya88myx4wykq0v5bh1xbq8";
};
stdenv.mkDerivation ({
name = "${baseName}-${version}";
inherit src version;
buildInputs = [ erlang rebar makeWrapper ];
# Elixir expects that UTF-8 locale to be set (see https://github.com/elixir-lang/elixir/issues/3548).
# In other cases there is warnings during compilation.
LANG = "en_US.UTF-8";
LC_TYPE = "en_US.UTF-8";
@ -66,6 +65,6 @@ stdenv.mkDerivation rec {
license = licenses.epl10;
platforms = platforms.unix;
maintainers = with maintainers; [ the-kenny havvy couchemar ];
maintainers = with maintainers; [ the-kenny havvy couchemar ankhers ];
};
}
})

View file

@ -57,6 +57,9 @@ rec {
# access for example elixir built with different version of Erlang, use
# `beam.packages.erlangR19.elixir`.
elixir = packages.erlang.elixir;
elixir-1_4 = packages.erlang.elixir-1_4;
elixir-1_3 = packages.erlang.elixir-1_3;
lfe = packages.erlang.lfe;
};