Handle new configuration file argument notation:

{pkgs, config, ...}:

svn path=/nixpkgs/trunk/; revision=12753
This commit is contained in:
Nicolas Pierron 2008-08-27 17:54:24 +00:00
parent c967e66ec7
commit 042bc846df

View File

@ -430,13 +430,19 @@ rec {
# function "merge" which expects two arguments. The attribute named # function "merge" which expects two arguments. The attribute named
# "require" is used to imports option declarations and bindings. # "require" is used to imports option declarations and bindings.
fixOptionSetsFun = merge: pkgs: opts: fixOptionSetsFun = merge: pkgs: opts:
let optionSet = final: configFun: let optionSet = config: configFun:
if __isFunction configFun then configFun pkgs final if __isFunction configFun then
else configFun; # backward compatibility. let result = configFun { inherit pkgs config; }; in
# {pkgs, config, ...}: {..}
if builtins.isAttrs result then result
# pkgs: config: {..}
else configFun pkgs config
# {..}
else configFun;
in in
final: merge "" config: merge ""
(map (x: removeAttrs x ["require"]) (map (x: removeAttrs x ["require"])
(uniqFlattenAttr (optionSet final) "require" [] (toList opts)) (uniqFlattenAttr (optionSet config) "require" [] (toList opts))
); );
fixOptionSets = merge: pkgs: opts: fixOptionSets = merge: pkgs: opts: