Refactor
This commit is contained in:
@@ -69,6 +69,57 @@ let
|
||||
in {
|
||||
mkContainer = contBuilder;
|
||||
mkVm = vmBuilder;
|
||||
mkApp = name: app:
|
||||
let
|
||||
# Keep legacy app modules working while storing a stricter internal contract.
|
||||
legacySetup =
|
||||
if app ? setup then app.setup else null;
|
||||
in {
|
||||
inherit name;
|
||||
requires = {
|
||||
secrets =
|
||||
if app ? requires && app.requires ? secrets then app.requires.secrets
|
||||
else if app ? sops && app.sops then [ name ]
|
||||
else [ ];
|
||||
databases =
|
||||
if app ? requires && app.requires ? databases then app.requires.databases
|
||||
else if app ? db && app.db then [ name ]
|
||||
else [ ];
|
||||
};
|
||||
exports = {
|
||||
authentik = {
|
||||
blueprints =
|
||||
if app ? exports && app.exports ? authentik && app.exports.authentik ? blueprints
|
||||
then app.exports.authentik.blueprints
|
||||
else [ ];
|
||||
};
|
||||
};
|
||||
runtime = {
|
||||
paths =
|
||||
if app ? runtime && app.runtime ? paths then app.runtime.paths
|
||||
else if app ? paths then app.paths
|
||||
else [ ];
|
||||
containers =
|
||||
if app ? runtime && app.runtime ? containers then app.runtime.containers
|
||||
else if app ? containers then app.containers
|
||||
else { };
|
||||
vm =
|
||||
if app ? runtime && app.runtime ? vm then app.runtime.vm
|
||||
else if app ? vm then app.vm
|
||||
else null;
|
||||
cron =
|
||||
if app ? runtime && app.runtime ? cron then app.runtime.cron
|
||||
else if app ? cron then app.cron
|
||||
else [ ];
|
||||
setup =
|
||||
if app ? runtime && app.runtime ? setup then app.runtime.setup
|
||||
else ({
|
||||
trigger = "";
|
||||
script = null;
|
||||
envFile = [ ];
|
||||
} // (if legacySetup != null then legacySetup else { }));
|
||||
};
|
||||
};
|
||||
mkData = { name, dir, vars?{} }: pkgs.runCommand name vars ''
|
||||
mkdir -p $out
|
||||
cp -r ${./data + "/${dir}"}/. $out/
|
||||
@@ -82,4 +133,4 @@ in {
|
||||
hostIp = if (config.virtualisation.podman.defaultNetwork.settings ? subnets)
|
||||
then (builtins.elemAt config.virtualisation.podman.defaultNetwork.settings.subnets 0).gateway
|
||||
else "10.88.0.1";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user