mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-09 21:14:56 +03:00
feat: add a warning when collecting modules if two modules have same names
This commit is contained in:
parent
16d9dde731
commit
3a6ebd75ef
@ -10,6 +10,7 @@
|
||||
python = "simple-python";
|
||||
php = "granular-php";
|
||||
haskell = "simple-haskell";
|
||||
debian = "simple-debian";
|
||||
};
|
||||
loader = b: b // {build = callPackageDream b.build {};};
|
||||
funcs = config.functions.subsystem-loading;
|
||||
|
@ -44,7 +44,21 @@ modules:
|
||||
(name: description:
|
||||
(import description.path {inherit dlib lib;})
|
||||
// {inherit (description) name subsystem;})
|
||||
(lib.listToAttrs collectedModules);
|
||||
(
|
||||
lib.foldl'
|
||||
(
|
||||
all: el:
|
||||
if lib.hasAttr el.name all
|
||||
then
|
||||
throw ''
|
||||
module named ${el.name} in subsystem ${el.value.subsystem} conflicts
|
||||
with a module with the same name from subsystem ${all.${el.name}.subsystem}
|
||||
''
|
||||
else all // {${el.name} = el.value;}
|
||||
)
|
||||
{}
|
||||
collectedModules
|
||||
);
|
||||
|
||||
instantiate = importedModules: loader:
|
||||
lib.mapAttrs
|
||||
|
Loading…
Reference in New Issue
Block a user