2025-03-12 15:21:38 +01:00

44 lines
1.1 KiB
Nix

# modules/services.nix
{
config,
lib,
tier ? "starter",
jsonConfig ? {},
...
}:
with lib; let
tiers = {
starter = {
services = ["portainer" "caddy" "n8n"];
description = "Basic management tools";
};
premium = {
services = ["portainer" "caddy" "n8n" "baserow"];
description = "Automation and database tools";
};
};
# Helper function to import modules, passing jsonConfig only if needed
importService = serviceName: let
mod = import ../services/${serviceName};
in
if isFunction mod
then mod {inherit jsonConfig;} # Pass jsonConfig if it's a function
else mod; # Use as-is if it's a set
in {
imports = map importService tiers.${tier}.services;
options.services.selfHostPlaybook = {
enable = mkEnableOption "self host playbook";
tier = mkOption {
type = types.enum ["starter" "premium"];
default = "starter";
description = "Service tier to enable";
};
};
config = mkIf config.services.selfHostPlaybook.enable {
# Add any additional configuration here if needed
};
}