44 lines
1.1 KiB
Nix
Raw Permalink Normal View History

2025-03-12 14:28:01 +01:00
# modules/services.nix
{
config,
lib,
tier ? "starter",
2025-03-12 15:21:38 +01:00
jsonConfig ? {},
2025-03-12 14:28:01 +01:00
...
}:
with lib; let
tiers = {
starter = {
services = ["portainer" "caddy" "n8n"];
description = "Basic management tools";
};
premium = {
services = ["portainer" "caddy" "n8n" "baserow"];
description = "Automation and database tools";
};
};
2025-03-12 15:21:38 +01:00
# 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
2025-03-12 14:28:01 +01:00
in {
2025-03-12 15:21:38 +01:00
imports = map importService tiers.${tier}.services;
2025-03-12 14:28:01 +01:00
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
};
}