diff --git a/pkgs/development/beam-modules/default.nix b/pkgs/development/beam-modules/default.nix index d54520212a51..07cc2ebd94b7 100644 --- a/pkgs/development/beam-modules/default.nix +++ b/pkgs/development/beam-modules/default.nix @@ -39,21 +39,17 @@ let # BEAM-based languages. elixir = defaultScope.elixir-1_4; - elixir-1_4 = if versionAtLeast (lib.getVersion erlang) "18" - then - lib.callElixir ../interpreters/elixir/1.4.nix { - debugInfo = true; - erlang = erlang; - } - else throw "Elixir requires at least Erlang/OTP R18."; + elixir-1_4 = lib.callElixir ../interpreters/elixir/1.4.nix "18" { + debugInfo = true; + erlang = erlang; + rebar = defaultScope.rebar; + }; - elixir-1_3 = if versionAtLeast (lib.getVersion erlang) "18" - then - lib.callElixir ../interpreters/elixir/1.3.nix { - debugInfo = true; - erlang = erlang; - } - else throw "Elixir requires at least Erlang/OTP R18."; + elixir-1_3 = lib.callElixir ../interpreters/elixir/1.3.nix "18" { + debugInfo = true; + erlang = erlang; + rebar = defaultScope.rebar; + }; lfe = callPackage ../interpreters/lfe { }; diff --git a/pkgs/development/beam-modules/lib.nix b/pkgs/development/beam-modules/lib.nix index 9d7a4bbd34ed..df0af4057637 100644 --- a/pkgs/development/beam-modules/lib.nix +++ b/pkgs/development/beam-modules/lib.nix @@ -43,12 +43,31 @@ rec { mkDerivation = pkgs.makeOverridable builder; }; - callElixir = drv: args: + /* Uses generic-builder to evaluate provided drv containing Elixir version + specific data. + + drv: package containing version-specific args; + vsn: minimum OTP version that Elixir will build on; + 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.4.nix + and similar files. + */ + callElixir = drv: vsn: args: let + inherit (stdenv.lib) versionAtLeast; builder = callPackage ../../development/interpreters/elixir/generic-builder.nix args; in - callPackage drv { - mkDerivation = pkgs.makeOverridable builder; - }; + if versionAtLeast (getVersion args.erlang) vsn + then + callPackage drv { + mkDerivation = pkgs.makeOverridable builder; + } + else + throw "Elixir requires at least Erlang/OTP R${vsn}."; }