39 lines
761 B
Nix
39 lines
761 B
Nix
{
|
|
name,
|
|
hm ? null,
|
|
sys ? null,
|
|
options ? null,
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
doctrine,
|
|
}: let
|
|
optionsSet = import options {
|
|
inherit config lib pkgs cfg name doctrine;
|
|
};
|
|
|
|
configSet = import configFiles.${doctrine.namespace} {
|
|
inherit config lib pkgs doctrine cfg;
|
|
};
|
|
|
|
configFiles = lib.filterAttrs (k: v: v != null) {
|
|
inherit sys hm;
|
|
};
|
|
|
|
cfg = config.${doctrine.prefix}.${name};
|
|
in {
|
|
config =
|
|
lib.optionalAttrs (configFiles ? ${doctrine.namespace})
|
|
(lib.mkIf cfg.enable configSet);
|
|
|
|
options = lib.optionalAttrs (options
|
|
!= null
|
|
&& optionsSet ? ${doctrine.namespace}) {
|
|
${doctrine.prefix}.${name} =
|
|
optionsSet.${doctrine.namespace}
|
|
// {
|
|
enable = lib.mkEnableOption name;
|
|
};
|
|
};
|
|
}
|