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 { 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; drv: package containing version-specific args;
builder: generic builder for all Erlang versions; 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 customize
args: arguments merged into version-specific args, used mostly to enable/disable high-level OTP dependencies;
features, like ODBC or WX support;
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 ( callErlang = drv: args:
let builder = pkgs.callPackage ../../development/interpreters/erlang/generic-builder.nix gargs; let
in { builder = callPackage ../../development/interpreters/erlang/generic-builder.nix args;
mkDerivation = a: builder (a // args); in
}); callPackage drv {
mkDerivation = pkgs.makeOverridable builder;
};
} }

View File

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