add jsonConfig to services

This commit is contained in:
m3tam3re
2025-03-12 15:21:38 +01:00
parent b97263495b
commit aa1e617e3a
5 changed files with 57 additions and 15 deletions

View File

@ -30,7 +30,7 @@
enable = true;
allowReboot = true;
dates = "04:00";
flake = "path:/etc/nixos/current";
flake = "path:/etc/nixos/current-systemconfig";
randomizedDelaySec = "45min";
flags = [
"--update-input nixpkgs"

View File

@ -3,6 +3,7 @@
config,
lib,
tier ? "starter",
jsonConfig ? {},
...
}:
with lib; let
@ -16,11 +17,16 @@ with lib; let
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
(serviceName: import ../services/${serviceName})
tiers.${tier}.services;
imports = map importService tiers.${tier}.services;
options.services.selfHostPlaybook = {
enable = mkEnableOption "self host playbook";