Refactor homelab modules

This commit is contained in:
Oliver Davies 2025-04-30 01:10:02 +01:00
parent e6f269b123
commit fe508bd127
9 changed files with 224 additions and 83 deletions

View file

@ -1,16 +1,34 @@
{ config, ... }:
{ config, lib, ... }:
with lib;
let
cfg = homelab.services.${service};
homelab = config.nixosModules.homelab;
service = "uptime-kuma";
in
{
services = {
uptime-kuma.enable = true;
options.nixosModules.homelab.services.${service} = {
enable = mkEnableOption "Enable ${service}";
nginx.virtualHosts."uptime.oliverdavies.uk" = {
forceSSL = true;
useACMEHost = "oliverdavies.uk";
url = mkOption {
default = "uptime.${homelab.baseDomain}";
type = types.str;
};
};
locations."/" = {
proxyPass = "http://localhost:${toString config.services.uptime-kuma.settings.PORT}";
recommendedProxySettings = true;
config = mkIf cfg.enable {
services = {
${service}.enable = true;
nginx.virtualHosts.${cfg.url} = {
forceSSL = true;
useACMEHost = homelab.baseDomain;
locations."/" = {
proxyPass = "http://localhost:${toString config.services.${service}.settings.PORT}";
recommendedProxySettings = true;
};
};
};
};