module: refactor as preparation for ldap-outpost

This commit is contained in:
WilliButz 2023-06-28 17:11:06 +02:00
parent 48fb996263
commit 360f4c7321
No known key found for this signature in database
GPG key ID: FB0513677AB15BEA

View file

@ -4,29 +4,23 @@
, ... , ...
}: }:
let let
cfg = config.services.authentik;
inherit (lib) inherit (lib)
types; types;
inherit (lib.modules) inherit (lib.modules)
mkDefault mkDefault
mkIf; mkIf
mkMerge;
inherit (lib.options) inherit (lib.options)
mkEnableOption mkEnableOption
mkOption; mkOption;
inherit (cfg.authentikComponents)
migrate
gopkgs
celery
staticWorkdirDeps;
settingsFormat = pkgs.formats.yaml {}; settingsFormat = pkgs.formats.yaml {};
in in
{ {
options.services.authentik = { options.services = {
authentik = {
enable = mkEnableOption "authentik"; enable = mkEnableOption "authentik";
authentikComponents = { authentikComponents = {
@ -51,8 +45,14 @@ in
default = true; default = true;
}; };
}; };
};
config = mkIf cfg.enable { config = mkMerge [
# authentik server
(mkIf config.services.authentik.enable (let
cfg = config.services.authentik;
in
{
services = { services = {
authentik.settings = { authentik.settings = {
blueprints_dir = mkDefault "${cfg.authentikComponents.staticWorkdirDeps}/blueprints"; blueprints_dir = mkDefault "${cfg.authentikComponents.staticWorkdirDeps}/blueprints";
@ -137,5 +137,6 @@ in
}; };
}; };
}; };
}; }))
];
} }