diff options
Diffstat (limited to 'pkgs/lib/composable-derivation.nix')
-rw-r--r-- | pkgs/lib/composable-derivation.nix | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/pkgs/lib/composable-derivation.nix b/pkgs/lib/composable-derivation.nix index f597dc07bd6a..03f1f48ec72c 100644 --- a/pkgs/lib/composable-derivation.nix +++ b/pkgs/lib/composable-derivation.nix @@ -9,18 +9,21 @@ let inherit (lib) nv nvs; in # grep the mailinglist by title "python proposal" (dec 08) # -> http://mail.cs.uu.nl/pipermail/nix-dev/2008-December/001571.html # to see why this got complicated when using all its features + # TODO add newer example using new syntax (kernel derivation proposal -> mailinglist) composableDerivation = { - # modify args before applying stdenv.mkDerivation, this should remove at least attrs removeAttrsBy - f ? lib.prepareDerivationArgs, - stdenv ? pkgs.stdenv, - # initial set of arguments to be passed to stdenv.mkDerivation passing prepareDerivationArgs by default - initial ? {}, - # example func : (x: x // { x.buildInputs ++ ["foo"] }), but see mergeAttrByFunc which does this for you - merge ? (lib.mergeOrApply lib.mergeAttrByFunc) - }: lib.applyAndFun - (args: stdenv.mkDerivation (f args)) - merge - (merge { inherit (lib) mergeAttrBy; } initial); + mkDerivation ? pkgs.stdenv.mkDerivation, + + # list of functions to be applied before defaultOverridableDelayableArgs removes removeAttrs names + # prepareDerivationArgs handles derivation configurations + applyPreTidy ? [ lib.prepareDerivationArgs ], + + # consider adding addtional elements by derivation.merge { removeAttrs = ["elem"]; }; + removeAttrs ? ["cfg" "flags"] + + }: (lib.defaultOverridableDelayableArgs ( a: mkDerivation a) + { + inherit applyPreTidy removeAttrs; + }).merge; # some utility functions # use this function to generate flag attrs for prepareDerivationArgs |