add doctrine

This commit is contained in:
Fabian Montero 2025-08-05 23:22:16 -06:00 committed by Alejandro Soto
parent 1c7810a49e
commit 26619394f4
No known key found for this signature in database
GPG key ID: A2C4C79764EE8F16
10 changed files with 113 additions and 63 deletions

View file

@ -0,0 +1,38 @@
{
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;
};
};
}