WIP: feat: Namespaced includes #3

Closed
austreelis wants to merge 6 commits from austreelis/feat/namespaced-includes into main AGit
Showing only changes of commit 71bc768dc1 - Show all commits

View file

@ -206,7 +206,7 @@ lib: {
in in
builtins.foldl' filter [ ] flattened; builtins.foldl' filter [ ] flattened;
austreelis marked this conversation as resolved
Review

nit: maybe a name like createNamespacedModule would be informative here?

nit: maybe a name like `createNamespacedModule` would be informative here?
doNamespace = createNamespacedModule =
{ namespace, include }: { namespace, include }:
if namespace == null then if namespace == null then
include include
@ -221,16 +221,17 @@ lib: {
description = "include ${namespace}"; description = "include ${namespace}";
}; };
austreelis marked this conversation as resolved
Review

Is this comment needed?

Is this comment needed?
Review

No, I thought I left it out when cleaning up my patch.

No, I thought I left it out when cleaning up my patch.
}; };
# config.${namespace} = lib.modules.override 1000 {};
}; };
austreelis marked this conversation as resolved
Review

Can we extract the builtins.map doNamespace flattened bit to a variable so that this value is easier to read? Something like builtins.seq throwOnConflict namespacedModules might make it easier to understand.

Can we extract the `builtins.map doNamespace flattened` bit to a variable so that this value is easier to read? Something like `builtins.seq throwOnConflict namespacedModules` might make it easier to understand.
namespacedModules = builtins.map createNamespacedModule flattened;
in in
builtins.seq throwOnConflict builtins.map doNamespace flattened; builtins.seq throwOnConflict namespacedModules;
in in
if lib.modules.validate.keys module then if lib.modules.validate.keys module then
{ {
austreelis marked this conversation as resolved
Review

Can we wrap usage of or in parens here? It can be a bit confusing otherwise.

Can we wrap usage of `or` in parens here? It can be a bit confusing otherwise.
inherit __key__; inherit __key__;
__file__ = builtins.toString module.__file__ or file; __file__ = builtins.toString (module.__file__ or file);
includes = normalizeIncludes module.includes or [ ]; includes = normalizeIncludes (module.includes or [ ]);
excludes = module.excludes or [ ]; excludes = module.excludes or [ ];
options = module.options or { }; options = module.options or { };
config = config =