forked from mirrors/nixpkgs
Handle new configuration file argument notation:
{pkgs, config, ...}: svn path=/nixpkgs/trunk/; revision=12753
This commit is contained in:
parent
c967e66ec7
commit
042bc846df
|
@ -430,13 +430,19 @@ rec {
|
|||
# function "merge" which expects two arguments. The attribute named
|
||||
# "require" is used to imports option declarations and bindings.
|
||||
fixOptionSetsFun = merge: pkgs: opts:
|
||||
let optionSet = final: configFun:
|
||||
if __isFunction configFun then configFun pkgs final
|
||||
else configFun; # backward compatibility.
|
||||
let optionSet = config: configFun:
|
||||
if __isFunction configFun then
|
||||
let result = configFun { inherit pkgs config; }; in
|
||||
# {pkgs, config, ...}: {..}
|
||||
if builtins.isAttrs result then result
|
||||
# pkgs: config: {..}
|
||||
else configFun pkgs config
|
||||
# {..}
|
||||
else configFun;
|
||||
in
|
||||
final: merge ""
|
||||
config: merge ""
|
||||
(map (x: removeAttrs x ["require"])
|
||||
(uniqFlattenAttr (optionSet final) "require" [] (toList opts))
|
||||
(uniqFlattenAttr (optionSet config) "require" [] (toList opts))
|
||||
);
|
||||
|
||||
fixOptionSets = merge: pkgs: opts:
|
||||
|
|
Loading…
Reference in a new issue