diff --git a/doctrine/lib/mk-module.nix b/doctrine/lib/mk-module.nix index 79c24c5..78449fe 100644 --- a/doctrine/lib/mk-module.nix +++ b/doctrine/lib/mk-module.nix @@ -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