erlang: use makeOverridable for customizations

This commit is contained in:
Daiderd Jordan
2017-06-08 22:13:30 +02:00
committed by Gleb Peregud
parent 3426c88bff
commit e88a89ad33
2 changed files with 38 additions and 48 deletions
+26 -10
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;
};
}