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