doctrine/lib: add optional prefix/namespace args to mkModule
This commit is contained in:
parent
8a7c4f302c
commit
f007e55e5f
|
@ -9,12 +9,14 @@
|
|||
sys ? null,
|
||||
options ? null,
|
||||
requires ? [],
|
||||
prefix ? doctrine.prefix,
|
||||
namespace ? doctrine.namespace,
|
||||
}: let
|
||||
optionsSet = import options {
|
||||
inherit config lib pkgs cfg name doctrine;
|
||||
};
|
||||
|
||||
configSet = import configFiles.${doctrine.namespace} {
|
||||
configSet = import configFiles.${namespace} {
|
||||
inherit config lib pkgs doctrine cfg;
|
||||
};
|
||||
|
||||
|
@ -22,17 +24,17 @@
|
|||
inherit sys hm;
|
||||
};
|
||||
|
||||
cfg = config.${doctrine.prefix}.${name};
|
||||
cfg = config.${prefix}.${name};
|
||||
in {
|
||||
config =
|
||||
lib.optionalAttrs (configFiles ? ${doctrine.namespace})
|
||||
lib.optionalAttrs (configFiles ? ${namespace})
|
||||
(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";
|
||||
assertion = cfg.enable -> config.${prefix}.${dependency}.enable;
|
||||
message = "${prefix}.${name}.enable requires ${prefix}.${dependency}.enable";
|
||||
})
|
||||
requires;
|
||||
}
|
||||
|
@ -40,9 +42,9 @@ in {
|
|||
|
||||
options = lib.optionalAttrs (options
|
||||
!= null
|
||||
&& optionsSet ? ${doctrine.namespace}) {
|
||||
${doctrine.prefix}.${name} =
|
||||
optionsSet.${doctrine.namespace}
|
||||
&& optionsSet ? ${namespace}) {
|
||||
${prefix}.${name} =
|
||||
optionsSet.${namespace}
|
||||
// {
|
||||
enable = lib.mkEnableOption name;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue