diff options
author | Robert Hensing <robert@roberthensing.nl> | 2023-07-11 11:46:12 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2023-07-11 12:22:57 +0200 |
commit | 65de18210d67a513ffd90d17b91738b597476f7a (patch) | |
tree | 2b7a72fca4a58465b86dabfca0bf0abea70ce248 /lib/modules.nix | |
parent | c70a5e922322f081c6cfb249a6cf4fbf291e53ee (diff) | |
download | nixpkgs-65de18210d67a513ffd90d17b91738b597476f7a.tar nixpkgs-65de18210d67a513ffd90d17b91738b597476f7a.tar.gz nixpkgs-65de18210d67a513ffd90d17b91738b597476f7a.tar.bz2 nixpkgs-65de18210d67a513ffd90d17b91738b597476f7a.tar.lz nixpkgs-65de18210d67a513ffd90d17b91738b597476f7a.tar.xz nixpkgs-65de18210d67a513ffd90d17b91738b597476f7a.tar.zst nixpkgs-65de18210d67a513ffd90d17b91738b597476f7a.zip |
lib/modules.nix: Apply argument `f` of old old byName
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 84715a5b1bb..b97d288228a 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -540,7 +540,7 @@ let mergeModules' = prefix: options: configs: let # an attrset 'name' => list of submodules that declare ‘name’. - declsByName = (f: modules: + declsByName = (modules: zipAttrsWith (n: concatLists) (map (module: let subtree = module.options; in if !(builtins.isAttrs subtree) then @@ -550,12 +550,14 @@ let Did you mean to define this outside of `options'? '' else - mapAttrs (n: f module) subtree - ) modules)) (module: option: - [{ inherit (module) _file; options = option; }] - ) options; + mapAttrs + (n: (module: option: + [{ inherit (module) _file; options = option; }] + ) module) + subtree + ) modules)) options; # an attrset 'name' => list of submodules that define ‘name’. - defnsByName = (f: modules: + defnsByName = (modules: zipAttrsWith (n: concatLists) (map (module: let subtree = module.config; in if !(builtins.isAttrs subtree) then @@ -569,12 +571,14 @@ let this option by e.g. referring to `man 5 configuration.nix'! '' else - mapAttrs (n: f module) subtree - ) modules)) (module: value: - map (config: { inherit (module) file; inherit config; }) (pushDownProperties value) - ) configs; + mapAttrs + (n: (module: value: + map (config: { inherit (module) file; inherit config; }) (pushDownProperties value) + ) module) + subtree + ) modules)) configs; # extract the definitions for each loc - defnsByName' = (f: modules: + defnsByName' = (modules: zipAttrsWith (n: concatLists) (map (module: let subtree = module.config; in if !(builtins.isAttrs subtree) then @@ -588,10 +592,12 @@ let this option by e.g. referring to `man 5 configuration.nix'! '' else - mapAttrs (n: f module) subtree - ) modules)) (module: value: - [{ inherit (module) file; inherit value; }] - ) configs; + mapAttrs + (n: (module: value: + [{ inherit (module) file; inherit value; }] + ) module) + subtree + ) modules)) configs; # Convert an option tree decl to a submodule option decl optionTreeToOption = decl: |