diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index f0a049bb4b23..fa748da0031c 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -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 {}; diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index dd4ed5e1bbf8..26d868a8e7c4 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -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; + }; + } diff --git a/pkgs/development/interpreters/lfe/1.2.nix b/pkgs/development/interpreters/lfe/1.2.nix new file mode 100644 index 000000000000..b81acdaa499e --- /dev/null +++ b/pkgs/development/interpreters/lfe/1.2.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation { + version = "1.2.1"; + sha256 = "0j5gjlsk92y14kxgvd80q9vwyhmjkphpzadcswyjxikgahwg1avz"; + maximumOTPVersion = "19"; +} diff --git a/pkgs/development/interpreters/lfe/default.nix b/pkgs/development/interpreters/lfe/generic-builder.nix similarity index 76% rename from pkgs/development/interpreters/lfe/default.nix rename to pkgs/development/interpreters/lfe/generic-builder.nix index cafcc4c28ee8..fb034a471e7c 100644 --- a/pkgs/development/interpreters/lfe/default.nix +++ b/pkgs/development/interpreters/lfe/generic-builder.nix @@ -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; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9ed13a1739f9..113e4fef2fc0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 diff --git a/pkgs/top-level/beam-packages.nix b/pkgs/top-level/beam-packages.nix index 8d01ad36139d..62ffaec26f3f 100644 --- a/pkgs/top-level/beam-packages.nix +++ b/pkgs/top-level/beam-packages.nix @@ -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.