Store the provider options flat

This commit is contained in:
Manuel Thalmann 2024-05-15 11:48:22 +02:00
parent 1a7a63e433
commit b781eb7e08

View file

@ -17,26 +17,23 @@ let
mkProvider = mkProvider =
{ {
secretLoader ? ({ ... }: ""), secretsScript ? "",
envLoader ? ({ ... }: { }), environment ? { },
configLoader ? ({ ... }: { }), config ? { },
options ? {}, options ? { },
... defaultOptions ? { }
}: { }:
{ ... }: {
inherit inherit
secretLoader secretsScript
envLoader environment
configLoader config
options options
; ;
}; };
syncProviders = { syncProviders = {
nextcloud = mkProvider { nextcloud = mkProvider {};
options = lib.types.submodule (
(mkOwncloudOptions { }));
};
proton = mkProvider {}; proton = mkProvider {};
manual = mkProvider {}; manual = mkProvider {};
}; };
@ -88,10 +85,15 @@ let
}; };
}; };
config = { config =
environment = syncProviders.${config.type}.envLoader config; let
secretsScript = syncProviders.${config.type}.secretLoader config; syncProvider = syncProviders.${config.type} config;
config = syncProviders.${config.type}.configLoader config; in {
inherit (syncProvider)
environment
secretsScript
config
;
}; };
}); });
in { in {