2017-06-18 17:24:18 +00:00
|
|
|
{ pkgs, stdenv }:
|
2017-06-04 18:26:37 +00:00
|
|
|
|
|
|
|
rec {
|
|
|
|
|
2017-06-07 23:39:17 +00:00
|
|
|
/* Similar to callPackageWith/callPackage, but without makeOverridable
|
|
|
|
*/
|
|
|
|
callPackageWith = autoArgs: fn: args:
|
|
|
|
let
|
|
|
|
f = if builtins.isFunction fn then fn else import fn;
|
|
|
|
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
|
|
|
|
in f (auto // args);
|
|
|
|
|
|
|
|
callPackage = callPackageWith pkgs;
|
|
|
|
|
2017-06-18 17:24:18 +00:00
|
|
|
/* 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));
|
|
|
|
|
2017-06-07 23:39:17 +00:00
|
|
|
/* Uses generic-builder to evaluate provided drv containing OTP-version
|
|
|
|
specific data.
|
2017-06-04 18:26:37 +00:00
|
|
|
|
|
|
|
drv: package containing version-specific args;
|
|
|
|
builder: generic builder for all Erlang versions;
|
2017-06-07 23:39:17 +00:00
|
|
|
args: arguments merged into version-specific args, used mostly to customize
|
|
|
|
dependencies;
|
|
|
|
|
|
|
|
Arguments passed to the generic-builder are overridable, used to
|
|
|
|
enable/disable high-level OTP features, like ODBC or WX support;
|
2017-06-04 18:26:37 +00:00
|
|
|
|
2017-06-07 23:39:17 +00:00
|
|
|
Please note that "mkDerivation" defined here is the one called from R16.nix
|
|
|
|
and similar files.
|
2017-06-04 18:26:37 +00:00
|
|
|
*/
|
2017-06-07 23:39:17 +00:00
|
|
|
callErlang = drv: args:
|
|
|
|
let
|
|
|
|
builder = callPackage ../../development/interpreters/erlang/generic-builder.nix args;
|
|
|
|
in
|
|
|
|
callPackage drv {
|
|
|
|
mkDerivation = pkgs.makeOverridable builder;
|
|
|
|
};
|
2017-06-04 18:26:37 +00:00
|
|
|
|
2017-06-23 16:38:10 +00:00
|
|
|
/* 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:
|
2017-06-23 00:34:32 +00:00
|
|
|
let
|
2017-06-23 16:38:10 +00:00
|
|
|
inherit (stdenv.lib) versionAtLeast;
|
2017-06-24 13:44:48 +00:00
|
|
|
builder = callPackage ../interpreters/elixir/generic-builder.nix args;
|
2017-06-23 00:34:32 +00:00
|
|
|
in
|
2017-06-23 16:38:10 +00:00
|
|
|
if versionAtLeast (getVersion args.erlang) vsn
|
|
|
|
then
|
|
|
|
callPackage drv {
|
|
|
|
mkDerivation = pkgs.makeOverridable builder;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw "Elixir requires at least Erlang/OTP R${vsn}.";
|
2017-06-23 00:34:32 +00:00
|
|
|
|
2017-06-04 18:26:37 +00:00
|
|
|
}
|