1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 06:01:15 +00:00

Merge pull request #27295 from ankhers/generalize_lfe

Generalize building of LFE
This commit is contained in:
Daiderd Jordan 2017-07-16 14:36:24 +02:00 committed by GitHub
commit fa74d99e42
6 changed files with 58 additions and 18 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 buildHex; };
# 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,7 @@
{ mkDerivation }:
mkDerivation {
version = "1.2.1";
sha256 = "0j5gjlsk92y14kxgvd80q9vwyhmjkphpzadcswyjxikgahwg1avz";
maximumOTPVersion = "19";
}

View file

@ -1,29 +1,38 @@
{ stdenv, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, beamPackages }:
{ stdenv, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, buildRebar3, buildHex }:
{ baseName ? "lfe"
, version
, maximumOTPVersion
, sha256 ? null
, rev ? version
, src ? fetchFromGitHub { inherit rev sha256; owner = "rvirding"; repo = "lfe"; }
}:
let
inherit (beamPackages) buildRebar3 buildHex;
proper = buildHex rec {
name = "proper";
inherit (stdenv.lib) getVersion versionAtLeast splitString head;
mainVersion = head (splitString "." (getVersion erlang));
proper = buildHex {
name = "proper";
version = "1.1.1-beta";
sha256 = "0hnkhs761yjynw9382w8wm4j3x0r7lllzavaq2kh9n7qy3zc1rdx";
configurePhase = ''
${erlang}/bin/escript write_compile_flags include/compile_flags.hrl
'';
};
in
buildRebar3 rec {
name = "lfe";
version = "1.2.1";
assert versionAtLeast maximumOTPVersion mainVersion;
src = fetchFromGitHub {
owner = "rvirding";
repo = name;
rev = version;
sha256 = "0j5gjlsk92y14kxgvd80q9vwyhmjkphpzadcswyjxikgahwg1avz";
};
buildRebar3 {
name = baseName;
buildInputs = [ makeWrapper ];
inherit src version;
buildInputs = [ erlang makeWrapper ];
beamDeps = [ proper ];
patches = [ ./no-test-deps.patch ];
doCheck = true;
@ -41,6 +50,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 +80,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

@ -6064,7 +6064,7 @@ with pkgs;
inherit (beam.interpreters)
erlang erlang_odbc erlang_javac erlang_odbc_javac
elixir elixir_1_5_rc elixir_1_4 elixir_1_3
lfe
lfe lfe_1_2
erlangR16 erlangR16_odbc
erlang_basho_R16B02 erlang_basho_R16B02_odbc
erlangR17 erlangR17_odbc erlangR17_javac erlangR17_odbc_javac

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.