diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2017-03-01 18:20:22 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2017-03-01 21:56:01 +0100 |
commit | fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0 (patch) | |
tree | b4a375a8a105886206cc6646128c283a6d8f6680 /lib/modules.nix | |
parent | 4150920a51c911b45a39f512b4292c1de63990c3 (diff) | |
download | nixpkgs-fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0.tar nixpkgs-fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0.tar.gz nixpkgs-fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0.tar.bz2 nixpkgs-fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0.tar.lz nixpkgs-fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0.tar.xz nixpkgs-fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0.tar.zst nixpkgs-fcec3e1c72ad7ac7eaacd00c8fc87dc04696fdb0.zip |
Revert "modules: add support for module replacement with disabledModules"
This reverts commit 3f2566689d14f1d7778d55ca807d1dad2f4695d1 for now. Evaluation of the tested job got broken, blocking nixos-unstable.
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index de9cfc637ae..4eee41306cd 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -20,8 +20,7 @@ rec { , prefix ? [] , # This should only be used for special arguments that need to be evaluated # when resolving module structure (like in imports). For everything else, - # there's _module.args. If specialArgs.modulesPath is defined it will be - # used as the base path for disabledModules. + # there's _module.args. specialArgs ? {} , # This would be remove in the future, Prefer _module.args option instead. args ? {} @@ -59,7 +58,10 @@ rec { closed = closeModules (modules ++ [ internalModule ]) ({ inherit config options; lib = import ./.; } // specialArgs); - options = mergeModules prefix (filterModules (specialArgs.modulesPath or "") closed); + # Note: the list of modules is reversed to maintain backward + # compatibility with the old module system. Not sure if this is + # the most sensible policy. + options = mergeModules prefix (reverseList closed); # Traverse options and extract the option values into the final # config set. At the same time, check whether all option @@ -85,16 +87,6 @@ rec { result = { inherit options config; }; in result; - - # Filter disabled modules. Modules can be disabled allowing - # their implementation to be replaced. - filterModules = modulesPath: modules: - let - moduleKey = m: if isString m then toString modulesPath + "/" + m else toString m; - disabledKeys = map moduleKey (concatMap (m: m.disabledModules) modules); - in - filter (m: !(elem m.key disabledKeys)) modules; - /* Close a set of modules under the ‘imports’ relation. */ closeModules = modules: args: let @@ -119,13 +111,12 @@ rec { else {}; in if m ? config || m ? options then - let badAttrs = removeAttrs m ["_file" "key" "disabledModules" "imports" "options" "config" "meta"]; in + let badAttrs = removeAttrs m ["imports" "options" "config" "key" "_file" "meta"]; in if badAttrs != {} then throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. This is caused by assignments to the top-level attributes `config' or `options'." else { file = m._file or file; key = toString m.key or key; - disabledModules = m.disabledModules or []; imports = m.imports or []; options = m.options or {}; config = mkMerge [ (m.config or {}) metaSet ]; @@ -133,10 +124,9 @@ rec { else { file = m._file or file; key = toString m.key or key; - disabledModules = m.disabledModules or []; imports = m.require or [] ++ m.imports or []; options = {}; - config = mkMerge [ (removeAttrs m ["_file" "key" "disabledModules" "require" "imports"]) metaSet ]; + config = mkMerge [ (removeAttrs m ["key" "_file" "require" "imports"]) metaSet ]; }; applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then |