Generalize building of LFE

This commit is contained in:
Justin Wood 2017-07-10 20:25:12 -04:00
parent 46dc5394cd
commit c87d4d4a19
5 changed files with 44 additions and 28 deletions

View File

@ -54,7 +54,8 @@ let
debugInfo = true;
};
lfe = callPackage ../interpreters/lfe { };
lfe = lfe_1_2;
lfe_1_2 = lib.callLFE ../interpreters/lfe/1.2.nix { inherit erlang buildRebar3; };
# Non hex packages
hex = callPackage ./hex {};

View File

@ -56,4 +56,26 @@ rec {
mkDerivation = pkgs.makeOverridable builder;
};
/* Uses generic-builder to evaluate provided drv containing Elixir version
specific data.
drv: package containing version-specific args;
builder: generic builder for all Erlang versions;
args: arguments merged into version-specific args, used mostly to customize
dependencies;
Arguments passed to the generic-builder are overridable.
Please note that "mkDerivation" defined here is the one called from 1.2.nix
and similar files.
*/
callLFE = drv: args:
let
inherit (stdenv.lib) versionAtLeast;
builder = callPackage ../interpreters/lfe/generic-builder.nix args;
in
callPackage drv {
mkDerivation = pkgs.makeOverridable builder;
};
}

View File

@ -0,0 +1,6 @@
{ mkDerivation }:
mkDerivation {
version = "1.2.1";
sha256 = "0j5gjlsk92y14kxgvd80q9vwyhmjkphpzadcswyjxikgahwg1avz";
}

View File

@ -1,33 +1,19 @@
{ stdenv, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, beamPackages }:
{ stdenv, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, buildRebar3 }:
let
inherit (beamPackages) buildRebar3 buildHex;
proper = buildHex rec {
name = "proper";
version = "1.1.1-beta";
sha256 = "0hnkhs761yjynw9382w8wm4j3x0r7lllzavaq2kh9n7qy3zc1rdx";
{ baseName ? "lfe"
, version
, sha256 ? null
, rev ? version
, src ? fetchFromGitHub { inherit rev sha256; owner = "rvirding"; repo = "lfe"; }
}:
configurePhase = ''
${erlang}/bin/escript write_compile_flags include/compile_flags.hrl
'';
};
in
buildRebar3 rec {
name = "lfe";
version = "1.2.1";
buildRebar3 {
name = "${baseName}";
src = fetchFromGitHub {
owner = "rvirding";
repo = name;
rev = version;
sha256 = "0j5gjlsk92y14kxgvd80q9vwyhmjkphpzadcswyjxikgahwg1avz";
};
inherit src version;
buildInputs = [ makeWrapper ];
beamDeps = [ proper ];
buildInputs = [ erlang makeWrapper ];
patches = [ ./no-test-deps.patch ];
doCheck = true;
checkTarget = "travis";
# These installPhase tricks are based on Elixir's Makefile.
# TODO: Make, upload, and apply a patch.
@ -41,6 +27,7 @@ buildRebar3 rec {
install -m644 _build/default/lib/lfe/ebin/* $ebindir
install -m755 -d $bindir
for bin in bin/lfe{,c,doc,script}; do install -m755 $bin $bindir; done
install -m755 -d $out/bin
@ -70,7 +57,7 @@ buildRebar3 rec {
downloadPage = "https://github.com/rvirding/lfe/releases";
license = licenses.asl20;
maintainers = with maintainers; [ yurrriq ];
maintainers = with maintainers; [ yurrriq ankhers ];
platforms = platforms.unix;
};
}

View File

@ -58,7 +58,7 @@ rec {
# `beam.packages.erlangR19.elixir`.
inherit (packages.erlang) elixir elixir_1_5_rc elixir_1_4 elixir_1_3;
lfe = packages.erlang.lfe;
inherit (packages.erlang) lfe lfe_1_2;
};
# Helper function to generate package set with a specific Erlang version.