erlang: put Elixir/LFE into per-OTP packageset.

This makes beam.package.erlangR19.abnf to be actually built with R19,
instead of the default R18. It means that Elixir and LFE are provided in
two versions, one built with R18 and with R19.

Please note that Elixir does not build with R16 and R17 - trying to
access beam.packages.erlang{R16,R17}.elixir will throw an error.
This commit is contained in:
Gleb Peregud 2017-06-18 19:24:18 +02:00
parent f66b0186dc
commit 7797e1a1dd
3 changed files with 28 additions and 9 deletions

View File

@ -1,7 +1,9 @@
{ stdenv, pkgs, erlang, overrides ? (self: super: {}) }:
let
inherit (stdenv.lib) fix' extends;
inherit (stdenv.lib) fix' extends getVersion versionAtLeast;
lib = pkgs.callPackage ./lib.nix {};
# FIXME: add support for overrideScope
callPackageWithScope = scope: drv: args: stdenv.lib.callPackageWith scope drv args;
@ -34,12 +36,18 @@ let
buildErlangMk = callPackage ./build-erlang-mk.nix {};
buildMix = callPackage ./build-mix.nix {};
## Non hex packages
# 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.";
lfe = callPackage ../interpreters/lfe { };
# Non hex packages
hex = callPackage ./hex {};
webdriver = callPackage ./webdriver {};
hex2nix = callPackage ../tools/erlang/hex2nix { };
cuter = callPackage ../tools/erlang/cuter { };
hex2nix = callPackage ../tools/erlang/hex2nix {};
cuter = callPackage ../tools/erlang/cuter {};
relxExe = callPackage ../tools/erlang/relx-exe {};
};
in fix' (extends overrides packages)

View File

@ -1,4 +1,4 @@
{ pkgs }:
{ pkgs, stdenv }:
rec {
@ -12,6 +12,15 @@ rec {
callPackage = callPackageWith pkgs;
/* Erlang/OTP-specific version retrieval, returns 19 for OTP R19 */
getVersion = x:
let
parse = drv: (builtins.parseDrvName drv).version;
in builtins.replaceStrings ["B" "-"] ["." "."] (
if builtins.isString x
then parse x
else x.version or (parse x.name));
/* Uses generic-builder to evaluate provided drv containing OTP-version
specific data.

View File

@ -1,7 +1,7 @@
{ pkgs, stdenv, callPackage, wxGTK30, darwin }:
rec {
lib = import ../development/beam-modules/lib.nix { inherit pkgs; };
lib = callPackage ../development/beam-modules/lib.nix {};
# Each
interpreters = rec {
@ -45,9 +45,11 @@ rec {
odbcSupport = true;
};
# Other Beam languages. These are built with beam.interpreters.erlang.
elixir = callPackage ../development/interpreters/elixir { debugInfo = true; };
lfe = callPackage ../development/interpreters/lfe { };
# Other Beam languages. These are built with `beam.interpreters.erlang`. To
# access for example elixir built with different version of Erlang, use
# `beam.packages.erlangR19.elixir`.
elixir = packages.erlang.elixir;
lfe = packages.erlang.lfe;
};
# Helper function to generate package set with a specific Erlang version.