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; 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 # Non hex packages
hex = callPackage ./hex {}; hex = callPackage ./hex {};

View file

@ -56,4 +56,26 @@ rec {
mkDerivation = pkgs.makeOverridable builder; 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 let
inherit (beamPackages) buildRebar3 buildHex; inherit (stdenv.lib) getVersion versionAtLeast splitString head;
proper = buildHex rec {
name = "proper"; mainVersion = head (splitString "." (getVersion erlang));
proper = buildHex {
name = "proper";
version = "1.1.1-beta"; version = "1.1.1-beta";
sha256 = "0hnkhs761yjynw9382w8wm4j3x0r7lllzavaq2kh9n7qy3zc1rdx"; sha256 = "0hnkhs761yjynw9382w8wm4j3x0r7lllzavaq2kh9n7qy3zc1rdx";
configurePhase = '' configurePhase = ''
${erlang}/bin/escript write_compile_flags include/compile_flags.hrl ${erlang}/bin/escript write_compile_flags include/compile_flags.hrl
''; '';
}; };
in in
buildRebar3 rec { assert versionAtLeast maximumOTPVersion mainVersion;
name = "lfe";
version = "1.2.1";
src = fetchFromGitHub { buildRebar3 {
owner = "rvirding"; name = baseName;
repo = name;
rev = version;
sha256 = "0j5gjlsk92y14kxgvd80q9vwyhmjkphpzadcswyjxikgahwg1avz";
};
buildInputs = [ makeWrapper ]; inherit src version;
buildInputs = [ erlang makeWrapper ];
beamDeps = [ proper ]; beamDeps = [ proper ];
patches = [ ./no-test-deps.patch ]; patches = [ ./no-test-deps.patch ];
doCheck = true; doCheck = true;
@ -41,6 +50,7 @@ buildRebar3 rec {
install -m644 _build/default/lib/lfe/ebin/* $ebindir install -m644 _build/default/lib/lfe/ebin/* $ebindir
install -m755 -d $bindir install -m755 -d $bindir
for bin in bin/lfe{,c,doc,script}; do install -m755 $bin $bindir; done for bin in bin/lfe{,c,doc,script}; do install -m755 $bin $bindir; done
install -m755 -d $out/bin install -m755 -d $out/bin
@ -70,7 +80,7 @@ buildRebar3 rec {
downloadPage = "https://github.com/rvirding/lfe/releases"; downloadPage = "https://github.com/rvirding/lfe/releases";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ yurrriq ]; maintainers = with maintainers; [ yurrriq ankhers ];
platforms = platforms.unix; platforms = platforms.unix;
}; };
} }

View file

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

View file

@ -58,7 +58,7 @@ rec {
# `beam.packages.erlangR19.elixir`. # `beam.packages.erlangR19.elixir`.
inherit (packages.erlang) elixir elixir_1_5_rc elixir_1_4 elixir_1_3; 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. # Helper function to generate package set with a specific Erlang version.