@@ -20,8 +20,7 @@ rec {
2020 , prefix ? []
2121 , # This should only be used for special arguments that need to be evaluated
2222 # when resolving module structure (like in imports). For everything else,
23− # there's _module.args. If specialArgs.modulesPath is defined it will be
24− # used as the base path for disabledModules.
23+ # there's _module.args.
2524 specialArgs ? {}
2625 , # This would be remove in the future, Prefer _module.args option instead.
2726 args ? {}
@@ -59,7 +58,10 @@ rec {
5958
6059 closed = closeModules (modules ++ [ internalModule ]) ({ inherit config options; lib = import ./.; } // specialArgs);
6160
62− options = mergeModules prefix (filterModules (specialArgs.modulesPath or "") closed);
61+ # Note: the list of modules is reversed to maintain backward
62+ # compatibility with the old module system. Not sure if this is
63+ # the most sensible policy.
64+ options = mergeModules prefix (reverseList closed);
6365
6466 # Traverse options and extract the option values into the final
6567 # config set. At the same time, check whether all option
@@ -85,16 +87,6 @@ rec {
8587 result = { inherit options config; };
8688 in result;
8789
88−
89− # Filter disabled modules. Modules can be disabled allowing
90− # their implementation to be replaced.
91− filterModules = modulesPath: modules:
92− let
93− moduleKey = m: if isString m then toString modulesPath + "/" + m else toString m;
94− disabledKeys = map moduleKey (concatMap (m: m.disabledModules) modules);
95− in
96− filter (m: !(elem m.key disabledKeys)) modules;
97−
9890 /* Close a set of modules under the ‘imports’ relation. */
9991 closeModules = modules: args:
10092 let
@@ -119,13 +111,12 @@ rec {
119111 else {};
120112 in
121113 if m ? config || m ? options then
122− let badAttrs = removeAttrs m ["_file" "key" "disabledModules" "imports" "options" "config" "meta"]; in
114+ let badAttrs = removeAttrs m ["imports" "options" "config" "key" "_file" "meta"]; in
123115 if badAttrs != {} then
124116 throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. This is caused by assignments to the top-level attributes `config' or `options'."
125117 else
126118 { file = m._file or file;
127119 key = toString m.key or key;
128− disabledModules = m.disabledModules or [];
129120 imports = m.imports or [];
130121 options = m.options or {};
131122 config = mkMerge [ (m.config or {}) metaSet ];
@@ -133,10 +124,9 @@ rec {
133124 else
134125 { file = m._file or file;
135126 key = toString m.key or key;
136− disabledModules = m.disabledModules or [];
137127 imports = m.require or [] ++ m.imports or [];
138128 options = {};
139− config = mkMerge [ (removeAttrs m ["_file" "key" "disabledModules" "require" "imports"]) metaSet ];
129+ config = mkMerge [ (removeAttrs m ["key" "_file" "require" "imports"]) metaSet ];
140130 };
141131
142132 applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then