diff options
| author | Alejandro Soto <alejandro@34project.org> | 2025-08-06 14:23:00 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2025-08-06 14:36:55 -0600 |
| commit | a8a58ce8999926edf65b86a8684056fbd84efe28 (patch) | |
| tree | f2735d8b0224e1a902b65f6992908c16945d7192 /doctrine/lib | |
| parent | 4544f75818369fa7a382eb7d55772519462287b2 (diff) | |
doctrine/lib: support module dependencies
Diffstat (limited to 'doctrine/lib')
| -rw-r--r-- | doctrine/lib/mk-module.nix | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/doctrine/lib/mk-module.nix b/doctrine/lib/mk-module.nix index c8b810d..fa1cd37 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.${doctrine.prefix}.${name} = lib.optionalAttrs (options != null && optionsSet ? ${doctrine.namespace}) optionsSet.${doctrine.namespace} |
