doctrine/lib: support module dependencies
This commit is contained in:
parent
026da8a6d1
commit
7c1071e396
|
@ -1,12 +1,14 @@
|
|||
{
|
||||
# The first few arguments are implicitly passed by the 'close' helper
|
||||
lib,
|
||||
pkgs,
|
||||
doctrine,
|
||||
name,
|
||||
config,
|
||||
hm ? null,
|
||||
sys ? null,
|
||||
options ? null,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
doctrine,
|
||||
requires ? [],
|
||||
}: let
|
||||
optionsSet = import options {
|
||||
inherit config lib pkgs cfg name doctrine;
|
||||
|
@ -24,7 +26,17 @@
|
|||
in {
|
||||
config =
|
||||
lib.optionalAttrs (configFiles ? ${doctrine.namespace})
|
||||
(lib.mkIf cfg.enable configSet);
|
||||
(lib.mkIf cfg.enable (lib.mkMerge [
|
||||
configSet
|
||||
{
|
||||
assertions =
|
||||
map (dependency: {
|
||||
assertion = cfg.enable -> config.${doctrine.prefix}.${dependency}.enable;
|
||||
message = "${doctrine.prefix}.${name}.enable requires ${doctrine.prefix}.${dependency}.enable";
|
||||
})
|
||||
requires;
|
||||
}
|
||||
]));
|
||||
|
||||
options = lib.optionalAttrs (options
|
||||
!= null
|
||||
|
|
Loading…
Reference in a new issue