erlang: use makeOverridable for customizations

This commit is contained in:
Daiderd Jordan 2017-06-08 01:39:17 +02:00 committed by Gleb Peregud
parent 3426c88bff
commit e88a89ad33
2 changed files with 38 additions and 48 deletions

View file

@ -2,20 +2,36 @@
rec {
/* Uses generic-builder to evaluate provided drv containing OTP-version specific data.
/* 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;
/* Uses generic-builder to evaluate provided drv containing OTP-version
specific data.
drv: package containing version-specific args;
builder: generic builder for all Erlang versions;
gargs: arguments passed to the generic-builder, used mostly to customize dependencies;
args: arguments merged into version-specific args, used mostly to enable/disable high-level OTP
features, like ODBC or WX support;
args: arguments merged into version-specific args, used mostly to customize
dependencies;
Please note that "mkDerivation" defined here is the one called from R16.nix and similar files.
Arguments passed to the generic-builder are overridable, used to
enable/disable high-level OTP features, like ODBC or WX support;
Please note that "mkDerivation" defined here is the one called from R16.nix
and similar files.
*/
callErlang = drv: gargs: args: pkgs.callPackage drv (
let builder = pkgs.callPackage ../../development/interpreters/erlang/generic-builder.nix gargs;
in {
mkDerivation = a: builder (a // args);
});
callErlang = drv: args:
let
builder = callPackage ../../development/interpreters/erlang/generic-builder.nix args;
in
callPackage drv {
mkDerivation = pkgs.makeOverridable builder;
};
}

View file

@ -12,54 +12,28 @@ rec {
erlang_odbc_javac = erlangR18_odbc_javac;
# These are standard Erlang versions, using the generic builder.
erlangR16 = lib.callErlang ../development/interpreters/erlang/R16.nix {} {};
erlangR16_odbc = lib.callErlang ../development/interpreters/erlang/R16.nix {} {
odbcSupport = true;
};
erlangR17 = lib.callErlang ../development/interpreters/erlang/R17.nix {} {};
erlangR17_odbc = lib.callErlang ../development/interpreters/erlang/R17.nix {} {
odbcSupport = true;
};
erlangR17_javac = lib.callErlang ../development/interpreters/erlang/R17.nix {} {
javacSupport = true;
};
erlangR17_odbc_javac = lib.callErlang ../development/interpreters/erlang/R17.nix {} {
erlangR16 = lib.callErlang ../development/interpreters/erlang/R16.nix {};
erlangR16_odbc = erlangR16.override { odbcSupport = true; };
erlangR17 = lib.callErlang ../development/interpreters/erlang/R17.nix {};
erlangR17_odbc = erlangR17.override { odbcSupport = true; };
erlangR17_javac = erlangR17.override { javacSupport = true; };
erlangR17_odbc_javac = erlangR17.override {
javacSupport = true; odbcSupport = true;
};
erlangR18 = lib.callErlang ../development/interpreters/erlang/R18.nix {
wxGTK = wxGTK30;
} {};
erlangR18_odbc = lib.callErlang ../development/interpreters/erlang/R18.nix {
wxGTK = wxGTK30;
} {
odbcSupport = true;
};
erlangR18_javac = lib.callErlang ../development/interpreters/erlang/R18.nix {
wxGTK = wxGTK30;
} {
javacSupport = true;
};
erlangR18_odbc_javac = lib.callErlang ../development/interpreters/erlang/R18.nix {
wxGTK = wxGTK30;
} {
erlangR18_odbc = erlangR18.override { odbcSupport = true; };
erlangR18_javac = erlangR18.override { javacSupport = true; };
erlangR18_odbc_javac = erlangR18.override {
javacSupport = true; odbcSupport = true;
};
erlangR19 = lib.callErlang ../development/interpreters/erlang/R19.nix {
wxGTK = wxGTK30;
} {};
erlangR19_odbc = lib.callErlang ../development/interpreters/erlang/R19.nix {
wxGTK = wxGTK30;
} {
odbcSupport = true;
};
erlangR19_javac = lib.callErlang ../development/interpreters/erlang/R19.nix {
wxGTK = wxGTK30;
} {
javacSupport = true;
};
erlangR19_odbc_javac = lib.callErlang ../development/interpreters/erlang/R19.nix {
wxGTK = wxGTK30;
} {
erlangR19_odbc = erlangR19.override { odbcSupport = true; };
erlangR19_javac = erlangR19.override { javacSupport = true; };
erlangR19_odbc_javac = erlangR19.override {
javacSupport = true; odbcSupport = true;
};