mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
allow the argument set of modules to be defined outside of option.nix file.
svn path=/nixpkgs/trunk/; revision=16191
This commit is contained in:
parent
736523d992
commit
a89f3bca50
@ -321,10 +321,10 @@ rec {
|
|||||||
# * cfgSet[0-9]: configuration set
|
# * cfgSet[0-9]: configuration set
|
||||||
#
|
#
|
||||||
# merge: the function used to merge options sets.
|
# merge: the function used to merge options sets.
|
||||||
# pkgs: is the set of packages available. (nixpkgs)
|
# args: is the set of packages available. (nixpkgs)
|
||||||
# opts: list of option sets or option set functions.
|
# opts: list of option sets or option set functions.
|
||||||
# config: result of this evaluation.
|
# config: result of this evaluation.
|
||||||
fixOptionSetsFun = merge: pkgs: opts: config:
|
fixOptionSetsFun = merge: args: opts: config:
|
||||||
let
|
let
|
||||||
# remove possible mkIf to access the require attribute.
|
# remove possible mkIf to access the require attribute.
|
||||||
noImportConditions = cfgSet0:
|
noImportConditions = cfgSet0:
|
||||||
@ -335,23 +335,10 @@ rec {
|
|||||||
cfgSet1;
|
cfgSet1;
|
||||||
|
|
||||||
filenameHandler = cfg:
|
filenameHandler = cfg:
|
||||||
if isPath cfg then import cfg
|
if isPath cfg then import cfg else cfg;
|
||||||
else cfg;
|
|
||||||
|
|
||||||
# call configuration "files" with one of the existing convention.
|
|
||||||
argumentHandler = cfg:
|
argumentHandler = cfg:
|
||||||
let
|
applyIfFunction cfg (args // { inherit config; });
|
||||||
# {..}
|
|
||||||
cfg0 = cfg;
|
|
||||||
# {pkgs, config, ...}: {..}
|
|
||||||
cfg1 = cfg { inherit pkgs config merge; };
|
|
||||||
# pkgs: config: {..}
|
|
||||||
cfg2 = cfg {} {};
|
|
||||||
in
|
|
||||||
if builtins.isFunction cfg0 then
|
|
||||||
if isAttrs cfg1 then cfg1
|
|
||||||
else builtins.trace "Use '{pkgs, config, ...}:'." cfg2
|
|
||||||
else cfg0;
|
|
||||||
|
|
||||||
preprocess = cfg0:
|
preprocess = cfg0:
|
||||||
let cfg1 = filenameHandler cfg0;
|
let cfg1 = filenameHandler cfg0;
|
||||||
@ -381,8 +368,8 @@ rec {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
fixOptionSets = merge: pkgs: opts:
|
fixOptionSets = merge: args: opts:
|
||||||
lib.fix (fixOptionSetsFun merge pkgs opts);
|
lib.fix (fixOptionSetsFun merge args opts);
|
||||||
|
|
||||||
|
|
||||||
# Generate documentation template from the list of option declaration like
|
# Generate documentation template from the list of option declaration like
|
||||||
|
Loading…
Reference in New Issue
Block a user